View Full Version : Help loading images on a set date?
xtrax
11-05-2008, 02:46 AM
Hey everyone,
I am new here - so forgive me if this is in the wrong thread.
I am looking for a script in PHP to load a specific image on a certain date..
Example
Says its the 4th of July - it would load the image for the July4.jpg etc etc...
Can anyone help us with this?
Xtrax
rangana
11-05-2008, 02:58 AM
$today=date('Fj'); // Get the date today in MonthDate format
echo "<img src='{$today}.jpg' alt='{$today}'>"; // Creates image
xtrax
11-05-2008, 03:06 AM
Thank you for your reply,
So if I wanted to load an image July 4, and then a second image say Dec 25,
could I use this...
$today=date('Fj'); // Get the date today in MonthDate format
$today ="7/4";
}else{
$today ="12/25";
}
echo "<img src='{$today}.jpg' alt='{$today}'>"; // Creates image
I need a little guidance I just started with my PHP Website a few days ago...
Xtrax
rangana
11-05-2008, 03:26 AM
$today=date('Fj'); // Get the date today in MonthDate format
$src='default.jpg'; // Default image in case date today is neither July4 or December25
// If date today is either December25 or July4, then set the source to today's date, else show default
$src=$today=='December25'||$today=='July4'?$today:$src;
echo "<img src='{$src}.jpg' alt='{$src}'>"; // Creates image
xtrax
11-05-2008, 03:33 AM
I thank you for your time!
It works great as I just tested it!
xtrax
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.