CODE
<?php
$path = "images/"; //path to the folder
$img_gal = scandir($path); //scandir() gets all files (and file ext) in a folder and puts them into an array
$img_count = count($img_gal) - 1; //count all the items in the array
$i = 2; //Start at 2 to skip the first 2 items ('[0] => .', '[1] => ..')
while ($i <= $img_count) { //loop tru the file
echo '<img src="'.$path.$img_gal[$i].'" /><br />';
$i++;
}
//The last 5 lines printout the array (youre files) for testing purpose only
//TEST
echo '<pre>';
print_r($img_gal); //print out the array
echo '</pre>';
///TEST
?>
this may help out
a simple way of doing it,
scandir() and then loop tru tha files
NOTE: i added an extra
- 1 in the
$img_count becouse the last item in the array that i got
kept echo'ing my folder as last item. (I think its my localhost)
so if you use this and youre last image does not show delete the
- 1hope it helps someone