I am new to PHP and basically I am trying to display an image gallery that retrieves photos from a folder. The thing is, I want the image with the most recent upload date to appear at the very beginning, and so on until the oldest one in the bottom.
This is what my PHP looks like (the important bit I guess)
$files = scandir('uploads/thumbs');
$ignore = array( 'cgi-bin', '.', '..');
foreach ($files as $file) {
if(!in_array($file, $ignore)) {
echo '<img src="uploads/thumbs/' . $file . '" />';
}
}
I would like to know if there's a way by PHP or maybe with a little help of CSS to display them in reverse order, making the newest one always to appear at the top of the page.
Any help or suggestion is very appreciated, regards from Argentina!