I wanted to upload recent images (Basically Scrteenshot) uploaded in the sub directory. The images are in this format "Screenshot from 2018-10-03 13-10-45.png" . I am using this post as a reference. But if you see my result , what i am getting is the basically the images are ordering itself in descending order. I am new to php. I am unable to tweak the code. Basically I want the images in ascending order.
This is my code.This one is giving the descending order. I wanted to show them in ascending order. *
$images = glob('*.{gif,png,jpg,jpeg}', GLOB_BRACE); //formats to look for
$num_of_files = 4; //number of images to display
foreach($images as $image)
{
$num_of_files--;
if($num_of_files > -1) //this made me laugh when I wrote it
echo "<b>".$image."</b><br>Created on ".date('D, d M y H:i:s', filemtime($image)) ."<br><img src="."'".$image."'"."><br><br>" ; //display images
else
break;
}
?>*
Just try to reverse your result array:
array_reverse ( $result );
Then you should get an ascending order.