1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//path to directory to scan. $directory = "assets/images/thumbs/small/"; //get all image files with a .jpg extension. $images = glob("" . $directory . "*.jpg"); $imgs = ''; // create array foreach($images as $image){ $imgs[] = "$image"; } // sort by date if you like //usort($imgs, create_function('$a,$b', 'return filemtime($a) - filemtime($b);')); //sort by name //usort($imgs, create_function('$a,$b', 'return strcmp($b, $a);')); //display images foreach ($imgs as $img) { echo "<img src='$img' /> "; } |