[Question][PHP] News image?
Posted 30 April 2005 - 08:11 PM
But I was wondering if it was possible to make a picture that showed the lastest news on a website ( which is mine ( so I know the tables ) )?
And how would I write such a PHP script?
I have never tried writting images in PHP.
Posted 01 May 2005 - 12:36 AM
list(,$song) = explode("\n", file_get_contents("http://ws.audioscrobbler.com/txt/recent/Jack_Knife"));
$fontnum = 3;
$fontwidth = imagefontwidth($fontnum);
$fontheight = imagefontheight($fontnum);
$string = $song;
$img = imagecreate(strlen($string)*$fontwidth, $fontheight);
$white = imagecolorallocate($img, 0, 0, 0);
$black = imagecolorallocate($img, 255, 255, 255);
$trans = imagecolortransparent($img, $white);
imagefill($img, 0, 0, $white);
imagestring($img, $fontnum, 0, 0, $string, $black);
That's the code for my 'now playing' image in my sig. To get the news from your site, you'd need to do a similar thing, just change the url in there, and parse the code to find the string you want within that.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users