diff options
Diffstat (limited to '_gallery/index.php')
-rw-r--r-- | _gallery/index.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/_gallery/index.php b/_gallery/index.php index 102711e..450928d 100644 --- a/_gallery/index.php +++ b/_gallery/index.php @@ -61,21 +61,26 @@ if (!isset($id)): <?= doLinking($data["contents"]) ?> </div> <small class="print-ignore text-muted"><?= isset($data["update_user"]) ? str_replace("%2", "<a class='update-user' href='/profile/" . $data["update_user"] . "'>" . resolveUser($data["update_user"]) . "</a>", str_replace("%1", timeAgo($data["update"]), l("lang_time_update_user"))) : str_replace("%1", timeAgo($data["update"]), l("lang_time_update")) ?></small> - <?php endif; ?> + <?php endif; + + $images = $data["images"]; + shuffle($images); + + ?> <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> <div> - <?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 1): ?> + <?php $index = 1; foreach ($images as $image): if ($index % 3 === 1): ?> <a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a> <?php endif; $index++; endforeach; ?> </div> <div> - <?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 2): ?> + <?php $index = 1; foreach ($images as $image): if ($index % 3 === 2): ?> <a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a> <?php endif; $index++; endforeach; ?> </div> <div> - <?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 0): ?> + <?php $index = 1; foreach ($images as $image): if ($index % 3 === 0): ?> <a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a> <?php endif; $index++; endforeach; ?> </div> |