Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DaveChappers

macrumors newbie
Original poster
Jan 10, 2009
10
0
Hey there, im trying to create a logo image that will change at a certain time for a radio show I help out on.
Basically when the show is on air say between 7 and 9 pm, I want the logo to say on air. And at other times to stay off air.
Not sure if there is any other way to do this, but im a bit of a newbie at web stuff.

Thanks for any help you can give

Dave
 
Do you know if your site uses PHP?

If so, you can easily use PHP to figure out the time of day and print the correct image tag.

PHP:
$time = date('G'); // 24-hour format without leading zeroes

if($time >= 7 && $time <= 21) {
     print "<img src='{filepath of ON-AIR image}'>";
} else {
     print "<img src='{filepath of OFF-AIR image}'>";
}

I'm assuming the 7 in your post is AM, if not change that number to 19.
 
If PHP is not an option you could use JavaScript to change out the image for that time period, but will only work for visitors who have it enabled. PHP (or any other server side language) would be the preferred method though.
 
Do you know if your site uses PHP?

If so, you can easily use PHP to figure out the time of day and print the correct image tag.

PHP:
$time = date('G'); // 24-hour format without leading zeroes

if($time >= 7 && $time <= 21) {
     print "<img src='{filepath of ON-AIR image}'>";
} else {
     print "<img src='{filepath of OFF-AIR image}'>";
}

I'm assuming the 7 in your post is AM, if not change that number to 19.

Ah this looks like it will work :) Thanks muchly!

However I know have a more tricky task. Gotta get it to do the same thing on the radio's myspace page.

Is that even possible, I know Myspace disables most javascript so thats prob out.

Any ideas guys
 
A thought: from MySpace you setup an image tag like,
HTML:
<img alt="my cool pic" src="myotherwebsite.com/images/cool_pic.php" />
Then in your PHP file named cool_pic.php it would have parts consisting of,
PHP:
header('Content-Type: image/gif');
// Place the previous code here, except just get the image file path and put it in a variable
//  here named $img_path
echo file_get_contents($img_path);
Disclaimer: I haven't tried this exact code so you may need to tweak it beyond what's mentioned.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.