PHP-Code:
<?php
Header("Content-Type: image/jpeg");
// Configuration
$scdef = ""; // Name of Stream if Server is down
$scip = ""; // IP or URL of your Shoutcast Server
$scport = ""; // Shoutcast Server Port
$scpass = ""; // Shoutcast Server Password (means Admin Password)
// End Configuration
// Connection
$scfp = fsockopen($scip, $scport, $errno, $errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0rnUser-Agent: SHOUTcast Song Status (Mozilla Compatible)rnrn");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
// End Connection
// Connection für Online/Offline-Anzeige
$fp = @fsockopen($scip, $scport, $errno, $errstr, 30);
fputs($fp,"GET /7.html HTTP/1.0rnUser-Agent: XML Getter (Mozilla Compatible)rnrn");
while(!feof($fp))
{
$datei .= fgets($fp, 1000);
}
fclose($fp);
$datei = ereg_replace(".*<body>", "", $datei);
$datei = ereg_replace("</body>.*", ",", $datei);
$eintraege = explode(",",$datei);
// Connection ende
//read xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);
$y++;
}
// End read xml elements
// get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
// End song info
fclose($scfp);
}
// Banner Configuration
// first textline
$image = "banner.png"; // name of the banner-picture
$img = imagecreatefrompng($image);
$bg = ImageColorAllocate($img, 0, 0, 0);
$white = ImageColorAllocate($img, 255, 255, 255); // config your first textcolor (this one is white)
$black = ImageColorAllocate($img, 0, 0, 0); // config your second textcolor (this one is black)
$green = ImageColorAllocate($img, 0, 255, 0);
$red = ImageColorAllocate($img, 255, 153, 0);
// if you need more or other colors do it like the way above
// Online oder Offline abfrage
if($eintraege[1]==1)
{
$status = "Radio ist ON AIR";
$color = "green";
$sendung=$servertitle; // the name of the show
$titel=$song[0]; // titel of the song now playing
}
else
{
$status = "Radio ist offline";
$color = "red";
$sendung=""; // Zusatztext
$titel=""; // Zusatztext
}
// Online oder Offline abfrage ende
ImageString($img, 4, 20, 6, $status, $$color); // display, position and color of the first textline
ImageString($img, 2, 20, 23, $sendung, $white); // display, position and color the name of the show
ImageString($img, 2, 20, 38, $titel, $white); // display, position and color of the songtitel
// if you need more textlines do it like the way above
ImageJPEG($img);
ImageDestroy($img)
?>
die php dann in .jpg umbenennen und in den ordner noch eine .htaccess speichern mit dem inhalt:
tja, und natürlich eine banner.png nicht vergessen (ist dann der hintergrund)
... edit by