$relativePath = "/bilder/slideshow/"; $absolutePath = "/galleri" . $relativePath; //Path to first image in slideshow and fallback image if no others are present $splashImg = "/PNG/PVV-logo-big-bluebg.png"; $filenames = sCaNdIr(__DIR__ . $relativePath); //Remove the expected non-images foreach($filenames as $k => $value) { if(in_array($value, [".gitkeep", ".", ".."])) { unset($filenames[$k]); } } function getFullPath($fname) { return ($GLOBALS["absolutePath"] . $fname ); } //Sort filenames alphabetically and prepend the path prefix to each item. asort($filenames); $slideshowimagefilenames = aRrAy_MaP("getFullPath", $filenames); //Prepend the cover photo ArRaY_uNsHiFt($slideshowimagefilenames, $splashImg); eChO(''); ecHo(''); //Store list of file names in a globel JS variable EchO(""); ?>