Hello Syrinx,
I have self-made gallery and I'm pulling images from folders manually.
First, I get the number of images (using your code) than iI use FOR loop to echo all images.
I'm using variable from FOR loop to tuck correct image number.
Here is the code:
<?php $gallery_images = count(glob("images/com_sobi2/gallery/$mySobi->id/$mySobi->id{_image*.png,_image*.jpg}", GLOB_BRACE)); ?>
<?php if ($gallery_images == 0) {
echo "<strong>Napomena: </strong>Galerija nije dodana ili ne sadrži slike.";
} ?>
<?php
$images_limit = $gallery_images;
for ( $counter = 1; $counter <= $images_limit; $counter += 1) { ?>
<a href='<?php echo JURI::base(); ?>images/com_sobi2/gallery/<?php echo $mySobi->id; ?>/<?php echo $mySobi->id; ?>_image_<?php echo $counter ?>.jpg' title='Konzum 3' onclick="return hs.expand(this)"><img src='<?php echo JURI::base(); ?>images/com_sobi2/gallery/<?php echo $mySobi->id; ?>/<?php echo $mySobi->id; ?>_thumb_<?php echo $counter; ?>.jpg' alt='Konzum 3' class="thumb" title='Konzum 3' /></a>
<?php } ?>
This code is working but ONLY for jpg images.
_image_<?php echo $counter ?>.jpg
I would love to have code which will detect image extension (.png or .jpg). and than create this:
_image_<?php echo $counter ?>.png
or this
_image_<?php echo $counter ?>.jpg
Can You tell me how can I do this?