I. I'm checking for latest image inside path "img/publicidad/":

(1) I've found all items in this folder and put them into an Array Array ( [img/publicidad/PUBLICIDAD-auspicio-CHARLA-05-DE-JUNIO.gif] => 39504830 [img/publicidad/PUBLICIDAD-auspicio-TALLER-21-22-23-DE-JUNIO.gif] => 39504817 [img/publicidad/t1.jpg] => 46855617 [img/publicidad/t2.jpg] => 46855601 [img/publicidad/t3.jpg] => 46855586 ) where the key is the file path and the value is the integer resulting from the subtraction of the current time stamp with that when the item was created.

(2) I've found the item whose time stamp is closest to now and, therefore, is the latest: array(1) { [0]=> string(63) "img/publicidad/PUBLICIDAD-auspicio-TALLER-21-22-23-DE-JUNIO.gif" } .

(3) Now I've extracted the key value only, which is the item's path: img/publicidad/PUBLICIDAD-auspicio-TALLER-21-22-23-DE-JUNIO.gif.

(4) Everything is O.K. up to this point and you should see a red square below with the number 3 on it, which is the third image in a series of three consecutively created images.


NOTE: Check inside ⇑ for image CSS. You'll see:
<img src=&quot;img/publicidad/t3.jpg&quot; style=&quot;display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 0px 0px;&quot; width=&quot;0&quot; height=&quot;0&quot;> (I've created a bounding DIV element to show where the image should be.)

II. Now, I'm checking for latest image inside path "img/":

(1) I've found all items in this folder and put them into an Array Array ( [img/t1.jpg] => 46855617 [img/t2.jpg] => 46855601 [img/t3.jpg] => 46855586 ) where the key is the file path and the value is the integer resulting from the subtraction of the current time stamp with that when the item was created.

(2) I've found the item whose time stamp is closest to now and, therefore, is the latest: array(1) { [0]=> string(10) "img/t3.jpg" } .

(3) Now I've extracted the key value only, which is the item's path: img/t3.jpg.

(4) Everything is O.K. up to this point and you should see a red square below with the number 3 on it, which is the third image in a series of three consecutively created images.


NOTE: As you can see, all is the same on the getting-the-path side of the issue, but this second time the image is displayed.