User Guides Winamp "Now Playing" script. (PHP)

Requires PHP, MySQL, and GD library

Database setup

Code:
CREATE TABLE `images` (
  `id` int(11) NOT NULL auto_increment,
  `user` varchar(250) NOT NULL default '',
  `text` varchar(250) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
INSERT INTO `images` VALUES (1, '[color=brown]USERNAME[/color]', 'Test]');
image.php

Code:
<?php
header("Content type: image/png");
include 'connect.php';
$connect = mysql_connect($host, $account, $password)
or die(mysql_error());
mysql_select_db("images", $connect)
or die(mysql_error());
$image = imagecreatefrompng("[color=orange]image.png[/color]");
$font_size = 8;
$color = imagecolorallocate($image, [color=teal]0,0,0[/color]);
$user = $_GET['user'];
if(isset($song)){
$text = $_GET['song'];
mysql_query("UPDATE images SET text='$text' WHERE user = '$user'");
}
$sql1 = mysql_query("SELECT * FROM images WHERE user='$user'")
or die(mysql_error());
$row1 = mysql_fetch_array($sql1);
$playing = $row1['text'];

ImageTTFText ($image, $font_size, [color=red]0[/color], [color=blue]0[/color], [color=green]0[/color], $color, "[color=beige]myfont.ttf[/color]", $playing);

imagepng($image);
imagedestroy($image);

?>
connect.php

Code:
<?php
$host= "localhost";
$account= "[color=purple]Username[/color]";
$password= "[color=purple]password[/color]";
$dbname= "[color=purple]Database[/color]";
?>

Upload all the files to your server. Upload a font file (ttf), create the image you wold like to have the text put on (png) and upload it.

Key
Fill in with desired username
Database info
Your image
Font color (RGB)
Text Angle
Distance from left of image for text to appear
Distance from top of image for text to appear
URL of uploaded font

Get Luke's Info Sender for Winamp 2/5

While configuring Luke's Info Sender, use this value:
http://yoursite.com/image.php?user=YOUR_USERNAME&song=

After all that is done, use this for your image code:

Code:
[img*]http://yoursite.com/image.php?user=YOUR_USERNAME[/img*]
(Without the '*'s)

or

Code:
[img]http://yoursite.com/image.php?user=[color=brown]YOUR_USERNAME[/color][/img]
for HTML
 
MyStIcYogi said:
wow, this is impressive. Now let me try this script and see :)
Thanks a lot Dude :)

By the way, I wasn't able to use this script on here for my avatar due to the fact that it wants an actual image file. Due to this, you can't set a PHP file for your avatar. :(
 
i'm not sure if it will work but rename image.php into image.png it will still run it as php :eek:hyeah: , althou i think you will need to put htaccess file into same directory as your image.png file. i'm not 100% sure about that tho.
 
Back
Top