I'm streaming audio and I want to get a signature up that displays my "currently playing" song. This is easily done with a PNG and a PHP script. However, I can't get that sig to work. I get the same error every time.
cannot be displayed, because it contains errors.
Here's the script:
I just can't get it going...Code:<?php // Ruff Dawg's 'Now Playing Sig w/ Background v. 1.5 May 7, 2004 // Special thanks to the originator, DJ Rampage // This image you can call immediately from an html file in the image tag // (i.e. <img src="black.php">) easy huh? Header("Content-type: image/png"); ///////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////*Configurables*////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /////////////////////*Background Picture File*//////////////////////// /* Replace "sicpic.png" with your own picture file (must be a .png) */ $im = imagecreatefrompng("banneraf.png"); /////////////////////////////*Host Information*///////////////////////////// $host = "Obviously, my IP is in here"; // No 'http://' in the host $port = "and the port too....."; //////////////////////////////////*Text Colors*//////////////////////////////// // text colors are in RGB $text_color1 = ImageColorAllocate($im,0,255,0); $text_color2 = ImageColorAllocate($im,0,255,0); ////////////////////////////////////*Text Size*///////////////////////////////// $text_size = "4"; //////////////////////////////*Text Alignment*///////////////////////////// //X alignment $x1 = "68"; $x2 = "60"; $x3 = "90"; //Y alignment $y1 = "0"; $y2 = "16"; $y3 = "33"; ///////////////////////////*Offline Message*/////////////////////////////// $offline1 = "We're Sorry"; $offline2 = "We are Currently Offline"; $offline3 = "Please Check Later"; ////////////////////////////////////////////////////////////////////////////////////////////////// /////*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_size,$x2,$y2,$string2,$text_color1); $px = (imagesx($im)-5*strlen($string3))/2; ImageString($im,$text_size,$x3,$y3,$string3,$text_color2); ImagePng($im); imagedestroy($im); ?>


LinkBack URL
About LinkBacks







Reply With Quote

Bookmarks