0
I’m making a page where there will be a slide, and each slide of this will have 20 photos, I found a code on the internet, where you just specify the folder where ta images and it generates all the code. The problem I’m facing is that to function properly, every 25 images it has to involve those images with a class. Ex: I will illustrate here with the example of only 3 photos, it will look 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
}
}
?>
It was not clear, the division will only be made if you have from 25 images? if you have 6 images, should not be done?
– Mauro Alexandre
25, 20 or 3 or other value?
– Marcelo Shiniti Uchimura
the division is every 25 images, I made with three just to exemplify, but by the way I confused more rs
– Sérgio Machado