1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?
header('Content-Type: image/png');
$name = $_GET['name'];
$html = implode('',file('http://ws.audioscrobbler.com/1.0/user/'.$name.'/recenttracks.rss'));
$title = explode('<item>', $html);
$title = explode('<title>', $title[1]);
$title = explode('</title>', $title[1]);
$tit = $title[0];
$date = explode('<item>', $html);
$date = explode('<pubDate>', $date[1]);
$date = explode('</pubDate>', $date[1]);
$dat = $date[0];
$image = imagecreate(300, 40);
$bg = imagecolorallocatealpha($image, 243, 243, 243, 127);
$text_color = imagecolorallocatealpha($image, 33, 124, 214, 0);
ImageString($image, 3, 1, 1, 'Last Song:', $text_color);
ImageLine($image, 1, 14, 300, 14, $text_color);
ImageString($image, 3, 1, 14, str_replace('–', '-', $tit), $text_color);
ImageString($image, 3, 1, 27, str_replace(' +0000', '', $dat), $text_color);
ImagePng($image);
?>
|