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.
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:
/gag_toons/%3C?php%20echo%20date('dmy')?%3E.gif
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:
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).
TIA!
<img src="folder/to/images/<?php echo date('dmy')?>.jpg" alt="daily img"/>
*Argeaux beat me to it
As you can see with these two examples, you can change the order of the letters to layout the date in American format as per your example.
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:
/gag_toons/%3C?php%20echo%20date('dmy')?%3E.gif
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?
I renamed my image, and it is working now.
Thanks for all your help!!