Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Reply
Thread Tools Search this Thread Display Modes
Old 30th December 2003, 21:35   #1
zee100
Senior Member
 
Join Date: Nov 2003
Location: Germany
Posts: 169
Need some help with php Script

I'm using this Script

PHP Code:
<?php
// This image you can call immediately from an html file in the image tag
// (i.e. <image src="black.php">) easy huh?

Header("Content-type: image/png");

// Fill in your own server information here: 
$host "68.3.55.67";
$port "8000";
$listenlink 'http://68.3.55.67:8000/listen.pls'//make link to stream

$fp = @fsockopen($host$port, &$errno, &$errstr5); //open connection
if(!$fp) {
$success=2//se-t if no connection
}
if(
$success!=2){ //if connection
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html
while(!feof($fp)) {
$page .= fgets($fp1000);
}
fclose($fp); //close connection
$page ereg_replace(".*<body>"""$page); //extract data
$page ereg_replace("</body>.*"","$page); //extract data
$numbers explode(",",$page); //extract data
$currentlisteners=$numbers***91;0***93;; //set variable
$connected=$numbers***91;1***93;; //set variable

if($connected==1//if DSP is connected
$wordconnected="yes"//set variable
else //if no DSP connection
$wordconnected="no"//set variable
$peaklisteners=$numbers***91;2***93;; //set variable
$maxlisteners=$numbers***91;3***93;; //set variable
$reportedlisteners=$numbers***91;4***93;; //set variable
}

// Image size can be changed here: (x, y)
$im ImageCreate(135,55);

// Background color in R(ed)G(reen)B(lue) below
$background_color ImageColorAllocate($im,255,255,255);

// text colors also in RGB
$text_color1 ImageColorAllocate($im,0,0,0);
$text_color2 ImageColorAllocate($im,0,0,0);

if(
$success!=&& $connected==1){

// song information is splitted in artist - title: 
// This requires consistent artist & title format (no ' - ' in title/artist)
// else you can use $numbers***91;6***93; as current song info below
$song=explode(" - ",$numbers***91;6***93;);

// strings can of course be replaced with your own bla
$string1"Artist: ".$song***91;0***93;;
$string2"Game: ".$song***91;1***93;;
$string3"Song: ".$song***91;2***93;;
$string4"Listeners: $currentlisteners";
}
else {
$string1"Remix 101 is currently";
$string2"OFFLINE.";
$string3"Please tune-in later.";
$string4":::";

}

// positioning below
$px = (imagesx($im)-5*strlen($string1))/2;
ImageString($im,1,$px,5,$string1,$text_color1);
// (image,font (from 1 to 5),starting x position, y position,line of text,color)
$px = (imagesx($im)-5*strlen($string2))/2;
ImageString($im,1,$px,20,$string2,$text_color2);
$px = (imagesx($im)-5*strlen($string3))/2;
ImageString($im,1,$px,30,$string3,$text_color2);
$px = (imagesx($im)-5*strlen($string4))/2;
ImageString($im,1,$px,45,$string4,$text_color1);
ImagePng($im);
// In response to KXRM's reaction:
// if you want to cache the picture, you should place this script in 
// your internetpage, remove line 5 (Header-call)
// and use ImagePng($im, "filename.png");
// NB: filename.png must have the right permission settings 
// (CHMOD 777 does it)
//
// Then you can place filename.png in the same html-file.
ImageDestroy($im);
?>
I want to change the size of the text but don't know how.
Anyone can help me with it?

Okey, this can be delete!
Find out myself.

Last edited by zee100; 30th December 2003 at 22:25.
zee100 is offline   Reply With Quote
Old 31st December 2003, 01:42   #2
soulful1
Senior Member
 
soulful1's Avatar
 
Join Date: Dec 2001
Posts: 240
Greetings,

You should be able to open the script with your web editor, hightlight the text you want to change and make the necessary changes. This is how I would do it using Dreamweaver.

Hope this helps.

soulful1
soulful1 is offline   Reply With Quote
Old 31st December 2003, 01:47   #3
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,109
imagestring

If that don't fit the bill, try using imagettftext

FesterHead is offline   Reply With Quote
Reply
Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump