Winamp 2 Web
Posted: Fri Jul 29, 2005 10:45 pm
I am sure there is an easier way to do this, but meh...
For the most part this was quite easy /biggrin.gif\' class=\'bbc_emoticon\' alt=\':D\' /> now to look at the code for the most part i think the image making is the hardest out of this script.
*Note: to save hours of headbanging >_> make sure to chmod the winamp-sig2.gif to 777 o.0
[code] $im = ImageCreateFromGif("winamp-sig.gif");[/code]
This is the base image you are editing, mine is:
[img]http://us3rX.killanet.net/winamp/winamp-sig.gif[/img]
[code] Imagettftext($im, 8, 0, 80, 66, $color, \'LUCON.TTF\', "$info");
Imagettftext($im, 8, 0, 86, 77, $color, \'LUCON.TTF\', "$length");[/code]
Depending on what GD your server is running, the \"8\" can mean either \"pixel(GD1)\" or \"point(GD2)\" size
The 0 means the angle, 0 is left to right, where 90 is bottom to top.
the 80 is the x pos for the text
the 66 is the y pos for the text
$color refers to $color = ImageColorAllocate($im, 255, 255, 255); whatever you want the color of the text to be, change the 255, 255, 255 to whatever such as if you wanted it to be red you would have; $color = ImageColorAllocate($im, 255, 0, 0);
LUCON.TTF is the font to \"type\" the text out on, also depends on what fonts the server has installed or you can upload the font, then link to it.
Then the $info and $length refer to;
$info = (strlen($artist . \" - \" . $title) > 47 ? substr_replace($artist . \" - \" . $title,\'...\',47,-1) : $artist . \" - \" . $title); & $length = $_GET[\'length\'];
Looks a bit weird huh? well what this does is, if the Artist and Title info is over 47 chars, it will make it display like: Artist - Title...
[code] Imagegif($im, \'./winamp-sig2.gif\');
ImageDestroy($im);[/code]
What this does is: saves the image to the same folder as the script and saves it as winamp-sig2.gif
The ImageDestroy is to free the image from the memory.
Also, if you want to use a jpg/png/etc should just be a matter of changing the gif to whatever. My Final Image looks something like:
[img]http://us3rX.killanet.net/winamp/winamp-sig2.gif[/img]
Now for automatically getting the data to the server. Rift has made a little program using the Winamp SDK(I think) and Vb/C++ that grabs the info from winamp and sends it to whatever url you tell it too. Here is a screen shot of the program.
[img]http://us3rX.killanet.net/winamp/winamp2web.png[/img]
Thanks for Rift for this.
if you prefer not using this program for sending the data, let me know, i have an irc version useing one dll and sockets /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />
This was my first tutorial, hopefully you enjoyed it, also if you learned something, use this, need help or anything post here and let me know. I\'ll be more then glad to help out. Also the php file is commented for some of the other commands. if need be let me know and ill go more into detail on it for you /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />
us3rX /ph34r.gif\' class=\'bbc_emoticon\' alt=\':ph34r:\' />
Winamp can be found [url=\"http://winamp.com\"][u]here.[/u][/url]
Rift program can be found [url=\"http://sage-web.com/Winamp2Web.zip\"][u]here.[/u][/url]*note i take no responsibilityif the program is pink and purple /blum.gif\' class=\'bbc_emoticon\' alt=\':P\' />
Php GD help can be found [url=\"http://php.net/manual/en/function.imagecreate.php\"][u]here.[/u][/url]
Winamp2Web Script Below:
[attachment=1235:attachment]