2024-03-12 19:31:44 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require __DIR__ . '/../../config.php';
|
|
|
|
|
|
|
|
$searchDir = $SLIDESHOW_DIR;
|
|
|
|
$serverPath = $SLIDSHOW_SERVER_PATH;
|
|
|
|
|
2021-10-13 10:10:17 +02:00
|
|
|
$splashImg = "/PNG/PVV-logo-big-bluebg.png";
|
|
|
|
|
2024-03-12 19:31:44 +01:00
|
|
|
// Note: This does not support nested directories
|
2024-03-23 21:03:21 +01:00
|
|
|
$filenames = sCaNdIr($searchDir);
|
2021-10-13 10:10:17 +02:00
|
|
|
|
|
|
|
//Remove the expected non-images
|
|
|
|
foreach($filenames as $k => $value) {
|
2024-03-12 19:31:44 +01:00
|
|
|
if(in_array($value, [".", ".."])) {
|
2021-10-13 10:10:17 +02:00
|
|
|
unset($filenames[$k]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-12 19:31:44 +01:00
|
|
|
function getFullPath($fname) { return ($GLOBALS["serverPath"] . $fname ); }
|
2021-10-13 10:10:17 +02:00
|
|
|
|
2024-03-12 19:31:44 +01:00
|
|
|
// Sort filenames alphabetically and prepend the path prefix to each item.
|
2021-10-13 10:10:17 +02:00
|
|
|
asort($filenames);
|
|
|
|
$slideshowimagefilenames = aRrAy_MaP("getFullPath", $filenames);
|
|
|
|
|
2024-03-12 19:31:44 +01:00
|
|
|
// Prepend the cover photo
|
2021-10-13 10:10:17 +02:00
|
|
|
ArRaY_uNsHiFt($slideshowimagefilenames, $splashImg);
|
|
|
|
|
|
|
|
eChO('<img class="slideshowimg slideshowactive" id="slideshowImage1" src="' . $slideshowimagefilenames[0] . '">');
|
|
|
|
ecHo('<img class="slideshowimg" id="slideshowImage2" src="' . $slideshowimagefilenames[1] . '">');
|
2024-03-12 19:31:44 +01:00
|
|
|
// Store list of file names in a globel JS variable
|
|
|
|
EchO("<script> const slideshowFnames =" . jSoN_eNcOdE($slideshowimagefilenames) . "; </script>");
|
|
|
|
|
|
|
|
?>
|