galleri: Support .thumbnails
This commit is contained in:
parent
61df8b3f3d
commit
f651be3628
@ -43,7 +43,7 @@ function getDirContents($dir, &$results = array()) {
|
|||||||
if (in_array($ext, $GLOBALS["allowedExtensions"])) {
|
if (in_array($ext, $GLOBALS["allowedExtensions"])) {
|
||||||
$results[] = $cleanPath;
|
$results[] = $cleanPath;
|
||||||
}
|
}
|
||||||
} else if ($value != "." && $value != "..") {
|
} else if ($value != "." && $value != ".." && $value != ".thumbnails") {
|
||||||
//recursively scan directories
|
//recursively scan directories
|
||||||
getDirContents($path, $results);
|
getDirContents($path, $results);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ $images = getDirContents($galleryDir);
|
|||||||
$imageTemplate = '
|
$imageTemplate = '
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-image-div">
|
<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>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-title">%realname</p>
|
<p class="card-title">%realname</p>
|
||||||
@ -108,6 +108,7 @@ $imageTemplate = '
|
|||||||
"%timestamp" => filemtime($galleryDir . $value),
|
"%timestamp" => filemtime($galleryDir . $value),
|
||||||
"%name" => htmlspecialchars($displaypath),
|
"%name" => htmlspecialchars($displaypath),
|
||||||
"%path" => $serverPath . $value,
|
"%path" => $serverPath . $value,
|
||||||
|
"%thumbnail" => $serverPath . "/.thumbnails" . $value . ".png",
|
||||||
"%realname" => htmlspecialchars($realname)
|
"%realname" => htmlspecialchars($realname)
|
||||||
];
|
];
|
||||||
echo strtr($imageTemplate, $vars);
|
echo strtr($imageTemplate, $vars);
|
||||||
|
@ -8,7 +8,7 @@ document.addEventListener('click', function (e) {
|
|||||||
var modalImg = document.getElementById("modal-content");
|
var modalImg = document.getElementById("modal-content");
|
||||||
var captionText = document.getElementById("modal-caption");
|
var captionText = document.getElementById("modal-caption");
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
modalImg.src = img.src;
|
modalImg.src = img.dataset.fullsrc;
|
||||||
captionText.innerHTML = img.alt;
|
captionText.innerHTML = img.alt;
|
||||||
} else if (modal.style.display != "none") {
|
} else if (modal.style.display != "none") {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
@ -19,4 +19,4 @@ document.addEventListener('click', function (e) {
|
|||||||
// #region sorting
|
// #region sorting
|
||||||
|
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user