2
I have a code that picks up the images from the folder images/FotosdoWhatsAPP
, but is displaying all images, would like to display only a quantity X
(ex: 5 images).
<?php
$dirname = "images/FotosWhatsApp/";
$images = glob($dirname."*.{jpg,jpeg,png,gif,JPG,PNG,JPEG,GIF}",GLOB_BRACE);
foreach($images as $image) {
echo '
<a href="'.$image.'" data-at-1920="'.$image.'">
<div class="div-thumbnail-portfolio" style="background-image: url('.$image.');background-repeat: no-repeat;background-size: cover; background-position: center center; " class="thumbnail-detalhe">
</div>
</a>
';
/*<a href="'.$image.'" rel="gallery" class="fresco" data-fresco-group="example">
<img src="'.$image.'" style="background-image: url('.$image.');background-repeat: no-repeat;background-size: cover; background-position: center center; " class="thumbnail-detalhe"/>
</a>*/
}
?>
Read about the function
array_slice
– Woss