I have this script, working, and giving a list off all images in a given folder:
<?php
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("$root/multimedia/img/immagini-di-paesaggi"));
$myFileTypes = ["php", "inc", "txt"];
foreach ($rii as $file)
{
if ($file->isDir() || in_array($file->getExtension(), $myFileTypes))
{
continue;
}
$files[] = $file->getPathname();
$filen = $file->getBasename('.jpg');
echo '<li><img src="'.$file.'" alt="'.$file.'" onclick="onClick(this)" /><br /><b>'.$filen.'</b></li>';
}
?>
I wonder if it would be possible to combine the above script to flickicity, so that I can get a flickicity gallery with all the images in that folder, without writing every time the name of each file (in that folder).
The code flickicity (you probably know already) is something like this
<div id="gallery" style="width: 50%; margin-left: auto; margin-right: auto; margin-bottom: 4%;">
<div class="carousel" data-flickity='{ "cellAlign": "center", "contain": true, "fullscreen": true, "wrapAround": true, "lazyLoad": 1 }'>
<div class="carousel-cell"><img data-flickity-lazyload="" alt="" onclick="onClick(this)" /></div>
</div>
<div class="carousel-cell"><img data-flickity-lazyload="" alt="" onclick="onClick(this)" /></div>
</div>
</div>