Sunday, 8 September 2013

Get latest image from directory

Get latest image from directory

I was getting my photo from a folder randomly as the code below:
$imagesDir = 'tags/chilli_crab/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
$randomImage = $images[array_rand($images)];
How can I change this to get the latest photo instead of the random one?
Thanks!!!!!!

No comments:

Post a Comment