Hello I have this code to show image from folder in php :
$handle = opendir(dirname(realpath(__FILE__)).'/galerija/accomodation/');
while($file = readdir($handle)) {
if($file !== '.' && $file !== '..') {
echo '<img src="galerija/accomodation/'.$file.'" rel="colorbox" />';
}
}
and it’s working everthing is fine but how can I set to show folder sorter by name or something, because I really need to sort that images and this script show’s only random images.Thank you.
You should find your answer here:
Sorting files by creation/modification date in PHP
There are other similar posts where you could get another usefull function for sorting.
So that your code should look something like this: