galleri: Support .thumbnails

This commit is contained in:
Felix Albrigtsen 2024-04-07 01:50:31 +02:00
parent 61df8b3f3d
commit f651be3628
2 changed files with 5 additions and 4 deletions

View File

@ -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 = '
<div class="card">
<div class="card-image-div">
<img src="%path" alt="%name" class="card-image modal-target">
<img src="%thumbnail" data-fullsrc="%path" alt="%name" class="card-image modal-target">
</div>
<div class="card-body">
<p class="card-title">%realname</p>
@ -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);

View File

@ -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
// #endregion