I'm making a page where you will have a slide, and each slide of that will have 20 photos, I found a code on the internet, where you just specify the folder where the images are and it generates all the code. The problem I'm facing is that to work properly, every 25 images it has to wrap these images with a class. Ex: I will exemplify here with the example of only 3 photos, it will stay like this
<div class="item">
imagem
imagem
imagem
</div>
<div class="item">
imagem
imagem
imagem
</div>
Here below I'll post the code I'm using
<?php
// variável que define o diretório das imagens
$dir = "imagens/galeria/";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
// verificando se o arquivo é .jpg
if (substr($filename, -4) == ".jpg") {
?>
<li><a data-fancybox="galeria" href="<?php echo $dir; ?><?php echo $filename; ?>" style="background-image: url(<?php echo $dir; ?><?php echo $filename; ?>)"></a></li>
<?php
}
}
?>