gallery: sort by timestamp. slideshow: fix transition bug on firefox

master
Felix Albrigtsen 2024-04-14 00:38:14 +02:00
parent 216e153f89
commit 9d9d99e6ba
2 changed files with 13 additions and 3 deletions

View File

@ -52,6 +52,17 @@ function getDirContents($dir, &$results = array()) {
}
$images = getDirContents($galleryDir);
function cmpModifyTime($a, $b) {
global $galleryDir;
$mtime_a = filemtime($galleryDir . $a);
$mtime_b = filemtime($galleryDir . $b);
return ($mtime_a > $mtime_b) ? -1 : 1;
}
usort($images, "cmpModifyTime");
$imageTemplate = '
<div class="card">
<div class="card-image-div">
@ -105,7 +116,6 @@ $imageTemplate = '
$vars = [
"%user" => htmlspecialchars($imguser),
"%time" => $modTime,
"%timestamp" => filemtime($galleryDir . $value),
"%name" => htmlspecialchars($displaypath),
"%path" => $serverPath . $value,
"%thumbnail" => $serverPath . "/.thumbnails" . $value . ".png",

View File

@ -21,7 +21,7 @@ function stepSlideshow(imgs) {
//Change source to next picture after it is faded out
slideshowIndex = (slideshowIndex + 1) % imgs.length;
ssi2.src = slideshowFnames[slideshowIndex];
}, 800);
}, 1000);
}
//Initialize slideshow, start interval
@ -29,4 +29,4 @@ if (slideshowFnames.length > 1) {
slideshowInterval = setInterval(()=>{
stepSlideshow(slideshowFnames);
}, SLIDESHOWDELAYMS);
}
}