made a few minor changes:
Randomised the "nothing" image.
Added a hit counter - purely for curiousity
nothing:
- Code: Select all
//If user is offline, or the last file has finished playing...
nothing:
$imageList = array("graveyard.png","pushthebutton.png","worldmap.png","record.png","fantasy.png","couch.png","tron.png","eye.png","dancer.png","hifi.png","mask.png","storm.png");
$image = imagecreatefrompng($imageList[rand(1,count($imageList))-1]);
$end = imagealphablending($image, true);
$save = imagesavealpha($image, true);
$color = imagecolorallocate($image, 0, 0, 0);
$font = getcwd()."/Capture it.ttf";
$fontSize = 14;
//text location
$x = 7;
$y = 20;
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
//$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
$x = 5;
$y = 18;
$color = imagecolorallocate($image, 255, 255, 255);
$fontRotation = 0;
$str = "Your IP Address is $_SERVER[REMOTE_ADDR]";
//$str = "Your browser is $_SERVER[HTTP_USER_AGENT]";
imagettftext($image, $fontSize, $fontRotation, $x, $y, $color, $font, $str);
imagettftext($image, 14, 0, 8, 148, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $time);
$strnot = "Not Watching Or Listening to Anything Right Now";
imagettftext($image, 14, 0, 5, 145, imagecolorallocate($image, 0, 0, 0), getcwd()."/Capture it.ttf", $time);
$strnot = "Not Watching Or Listening to Anything Right Now";
imagettftext($image, 10, 0, 140, 78, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strnot);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 371, 136, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strwww);
$strwww = "www.Mess-Hall.co.uk";
imagettftext($image, 14, 0, 370, 135, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strwww);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 8, 0, 377, 146, imagecolorallocate($image, 30, 30, 30), getcwd()."/Capture it.ttf", $strtag);
$strtag = "A Small Review of Almost Everything";
imagettftext($image, 8, 0, 376, 145, imagecolorallocate($image, 255, 255, 255), getcwd()."/Capture it.ttf", $strtag);
// Uncomment the next line (remove //) to display the number of hits on your page.
//echo $hits;
//hits text location
header("Content-type: image/png");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Fri, 19 Jan 1994 05:00:00 GMT");
header("Pragma: no-cache");
imagepng($image);
imagepng($image);
imagedestroy($image);
exit();
hit Counter:
- Code: Select all
$xml = @simplexml_load_file("http://".$server."/rest/getNowPlaying.view?u=".$admin."&p=".$adminpass."&v=1.5.0&c=signature");
if($xml==false) {
goto offline;
}
// Hitcounter
$filename = 'hitcountdayz.txt';
$handle = fopen($filename, 'r');
$hits = trim(fgets($handle)) + 1;
fclose($handle);
$handle = fopen($filename, 'w');
fwrite($handle, $hits);
fclose($handle);
If anyone can get the hit counter to display correctly PLMK, I tried for a couple of hours yesterday and struggled like mad, displaying it worked, but it broke the rest of the code.