No need for the RSS feed. If there's plaintext available I will use it.Ifurin said:It'll be dead easy, just parse the RSS feed, set a time-out period of like 4 minutes or something to refresh it again, then output your horrifyingly ugly image.
It'd be even easier if my host had PHP 5 installed
I bet I use about 12 lines of text rendering code to get the black shadow under the white textIfurin said:where is plaintext
link please
edit: found it, christ i'm blind
I bet I can write it shorted than you!
<?php
$username = "egj";
$npstring = "Playing: ";
$font = 2;
$line = file("http://ws.audioscrobbler.com/txt/recent/" . $username);
$line[1][strlen($line[1]) - 1] = '';
header("Content-type: image/gif");
$img_handle = ImageCreate(ImageFontWidth($font) * (strlen($line[1]) + strlen($npstring)) + 4, ImageFontHeight($font) + 4) or die ("Cannot Create image");
$back_color = ImageColorAllocate($img_handle, 255, 0, 255);
$shadow_color = ImageColorAllocate($img_handle, 0, 0, 0);
$txt_color = ImageColorAllocate($img_handle, 255, 255, 255);
for($x = 3; $x < 6; $x++) {
for($y = 1; $y < 4; $y++) ImageString($img_handle, $font, $x, $y, $npstring . $line[1], $shadow_color);
}
ImageString($img_handle, $font, 4, 2, $npstring . $line[1], $txt_color);
ImageColorTransparent($img_handle, $back_color);
ImageGif($img_handle);
?>
<?php
$c = (file_get_contents('access.txt') > time() + 180) ? file('cache.txt') : file('http://ws.audioscrobbler.com/txt/recent/shittocks');
file_put_contents('cache.txt', $c);
file_put_contents('access.txt', time());
$s = trim($c[1]);
$im = imagecreatetruecolor(300, 40);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 33, 33, 33);
imagecolortransparent($im, $black);
imagestring($im, 2, 11, 26, $s, $grey);
imagestring($im, 2, 10, 25, $s, $white);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>