The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Daily image

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #23132

    I’ve got a folder of images, each titled with a date, such as 051508.jpg. Is there a way to get it to automatically use the correct image on the correct day (according to my time zone)? I know there’s a way to grab a random image every time the page reloads, but I need a specific image for a specific day.



    you can do it with php:

    <img src="folder/to/images/<?php echo date(‘dmy’)?>.jpg" alt="daily img"/>


    Thanks for the help guys. You definitely put me on the right track. I found a site online that explains all the different date and time formats.

    It’s not pulling the image up however when I put the code in. It comes in as an empty box with the little missing image icon. When I right-click and "Open image in new window", it gives me a page not found with the url being:


    with gag_toons/ being the directory where my images are stored. I’ve renamed them to 08262008.gif and so on. Based on the code you gave me, here’s is what I’m using to call the image:

    <img src="gag_toons/<?php echo date(‘dmy’)?>.gif" width="245" height="197" alt="daily img"/>

    Any ideas?


    Well, I didn’t, but I’ve changed it and I get the same results. According to GoDaddy I do have php installed. Is there any easy way to check to make sure that it is? Any other ideas?


    Never mind – I just figured out the problem. Part of it was that I didn’t have .php as the file extension. When I changed that, the image still wasn’t loading. When I right-clicked and opened the image in a new window, I found what the problem was. The echo date was giving the date differently than I had thought (and different than what the website that I used as reference said).

    I renamed my image, and it is working now.

    Thanks for all your help!!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.