From f651be3628442cf724dcf964b7a5ca2519799303 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 7 Apr 2024 01:50:31 +0200 Subject: [PATCH] galleri: Support .thumbnails --- www/galleri/index.php | 5 +++-- www/js/galleri.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/www/galleri/index.php b/www/galleri/index.php index 6e5041e..b626216 100644 --- a/www/galleri/index.php +++ b/www/galleri/index.php @@ -43,7 +43,7 @@ function getDirContents($dir, &$results = array()) { if (in_array($ext, $GLOBALS["allowedExtensions"])) { $results[] = $cleanPath; } - } else if ($value != "." && $value != "..") { + } else if ($value != "." && $value != ".." && $value != ".thumbnails") { //recursively scan directories getDirContents($path, $results); } @@ -55,7 +55,7 @@ $images = getDirContents($galleryDir); $imageTemplate = '
- %name + %name

%realname

@@ -108,6 +108,7 @@ $imageTemplate = ' "%timestamp" => filemtime($galleryDir . $value), "%name" => htmlspecialchars($displaypath), "%path" => $serverPath . $value, + "%thumbnail" => $serverPath . "/.thumbnails" . $value . ".png", "%realname" => htmlspecialchars($realname) ]; echo strtr($imageTemplate, $vars); diff --git a/www/js/galleri.js b/www/js/galleri.js index 59867c9..a1cb4bf 100644 --- a/www/js/galleri.js +++ b/www/js/galleri.js @@ -8,7 +8,7 @@ document.addEventListener('click', function (e) { var modalImg = document.getElementById("modal-content"); var captionText = document.getElementById("modal-caption"); modal.style.display = "block"; - modalImg.src = img.src; + modalImg.src = img.dataset.fullsrc; captionText.innerHTML = img.alt; } else if (modal.style.display != "none") { modal.style.display = "none"; @@ -19,4 +19,4 @@ document.addEventListener('click', function (e) { // #region sorting -// #endregion \ No newline at end of file +// #endregion