FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


online / offline image dilemma





Slick
hi

is jpeg code in any way manipulative?

the reason i ask is.. that a site which contains links for radio has added me to there directory!

but the site is forum based therefore template orientated!

he can add an image and link it to my site but thats it!

is there anything i could do to make the image change if i was online etc?

i have a script that i use to show if were broadcasting etc using php...


would there be a way he could link to say .... imagestatus.gif

and then set up a php script to copy an online image to that file name when were broadcasting and then when we go offline it then copies the offline image to that image name....

thus the people on the directory will see if were online or not!

cheers for any help - i have no idea really when talkin about php! lol
Grimboy
Yes, Frihost has the GD image libary installed so what you need to do is.
Code:

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

$im    = imagecreatefrompng("images/button1.png");
$textcolour = imagecolorallocate($im, 220, 210, 60); //currently orange change as you wish (RGB)
$thisfile = http://www.yoursite.com/thisfile.php //this file

header('Content-Length: '.filesize($thisfile));
header('Content-type: image/jpeg');
readfile($thisfile);

imagestring($im, 3, $px, 9, $string, $textcolour); // imagestring ( resource image, font, x, y, string, colour )
imagepng($im);
imagedestroy($im);

$file = fopen ("http://www.radioserver.com/radio.m3u", "r");
if ($file) {
  imagestring($im, 3, $px, 9, "up", $textcolour); // imagestring ( resource image, font, x, y, string, colour )
}
else{
  imagestring($im, 3, $px, 9, "down", $textcolour); // imagestring ( resource image, font, x, y, string, colour )
}
fclose($file);

imagepng($im);
imagedestroy($im);
?>


In his forum he would then do an image tag with the target being the php file.

There will be mistakes in that since I typed it up quickly but it might work and has the right idea.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.