PHP Code:
<?php
// Ruff Dawg's 'Now Playing Sig w/ Background v. 1.5 May 7, 2004
// Special thanks to the originator, DJ Rampage
// Modded specifically for Bluepearl by Spawndemon
// This image you can call immediately from an html file in the image tag
// (i.e. <img src="sic_pic.png">) easy huh?
Header("Content-type: image/png");
////////////////////////////////////////////////////////////////////////////////////////
/
//////////////////////////////*Configurables*//////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
/////////////////////*Background Picture File*////////////////////////
/* Replace "sic_pic.png" with your own
picture file (must be a .png) */
$im =
imagecreatefrompng("sig.png");
/////////////////////////////*Host Information*/////////////////////////////
$host = "Your radio host url"; // No 'http://' in the host
$port = "Your radio host port";
//////////////////////////////////*Text Colors*////////////////////////////////
// text colors are in RGB
$text_color1 = ImageColorAllocate($im,145,150,161);
$text_color2 = ImageColorAllocate($im,14,15,16);
////////////////////////////////////*Text Size*/////////////////////////////////
$text_size = "4";
$text_size1 = "3";
//////////////////////////////*Text Alignment*/////////////////////////////
//X alignment
$x1 = "20";
$x2 = "40";
$x3 = "490";
//Y alignment
$y1 = "175";
$y2 = "25";
$y3 = "25";
///////////////////////////*Offline Message*///////////////////////////////
$offline1 = "MPC Radio Is Currently Offline";
$offline2 = "Please Check Later";
$offline3 = "";
////////////////////////////////////////////////////////////////////////////////////////
//////////
/////*DON'T TOUCH THE CODE BELOW UNLESS//////////
///YOU KNOW EXACTALLY WHAT YOU ARE DOING*//
////////////////////////////////////////////////////////////////////////////////////////
///////
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
if(!$fp) {
$success=2;
}
if($success!=2){ //if connection
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla
Compatible)\r\n\r\n");
while(!feof($fp)) {
$page .= fgets($fp, 1000);
}
fclose($fp);
$page = ereg_replace(".*<body>", "", $page); //extract data
$page = ereg_replace("</body>.*", ",", $page); //extract data
$numbers = explode(",",$page);
$currentlisteners=$numbers[0];
$connected=$numbers[1];
if($connected==1)
$wordconnected="yes";
else
$wordconnected="no";
$peaklisteners=$numbers[2];
$maxlisteners=$numbers[3];
$reportedlisteners=$numbers[4];
}
if($success!=2 && $connected==1){
$song=explode("<>" ,$numbers[6]);
$string1= $song[0];
$string2= $song[1];
$string3= "$currentlisteners/$maxlisteners";
}
else {
$string1= $offline1;
$string2= $offline2;
$string3= $offline3;
}
$px = (imagesx($im)-5*strlen($string1))/2;
ImageString($im,$text_size,$x1,$y1,$string1,$text_ color1);
$px = (imagesx($im)-5*strlen($string2))/2;
ImageString($im,$text_size1,$x2,$y2,$string2,$text _color2);
$px = (imagesx($im)-5*strlen($string3))/2;
ImageString($im,$text_size1,$x3,$y3,$string3,$text _color2);
ImagePng($im);
imagedestroy($im);
?>
And there ye go. Both the PNG and the PHP have to be on the same directory. And both have to be uploaded on a PHP allowed FTP Access.
Well, There ya go!