1
I have this code that works fine, but I’d like the last images to be uploaded appear at the top of the page, instead of appearing in an order apparently 'Random'.
They are not in a database, they are only in a folder where they go using the function move_uploaded_file(pics/....)
.
$myDirectory = opendir("pics");
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
closedir($myDirectory);
$indexCount = count($dirArray);
for($index=0; $index < $indexCount; $index++) {
$temp = explode('.', $dirArray[$index]);
$extension = strtolower(end($temp));
if ($extension == 'jpg' || $extension == 'png' || $extension == 'tif' || $extension == 'gif' || $extension == 'jpeg' || $extension == 'JPG'){
echo '<a href="pics/' . $dirArray[$index] . '"><img class="image" src="pics/' . $dirArray[$index] . '" alt="Image"></a>';
}
}
This is what it is, but I wanted you to do the image display (last part of my code), and the last one uploaded would be at the top of the page
– Miguel
@Miguel, editing was done, with the change of viewing the images
– user6026
Obgado, that was it
– Miguel