I just assumed you knew what PHP was, sorry about that.
There's also three major fuck-ups in that script, it should be this:
Code:
<?php
$ticker=fopen('http://news.bbc.co.uk/nol/ifs_news/hi/front_page/ticker.stm','r');
function findNewsItem($str,$pos)
{
$str=substr($ticker,(strpos($ticker,"theSummaries[{$pos}] = \"")+18));
$str=substr($str,0,strpos($str,'.')+1);
return $str;
}
function text($x,$n)
{
ImageString($im,4,$x,10,$news[$n],$black);
}
$news=array('','','','');
for($i=0;$i<3;$i++)
{
$news[$i]=findNewsItem($news[$i],$i);
}
unset($ticker);
$im=ImageCreate(500,150);
$white=ImageColorAllocate($im,0xFF,0xFF,0xFF);
$black=ImageColorAllocate($im,0x00,0x00,0x00);
text(10,0);
text(45,1);
text(80,2);
text(115,3);
// if the image gets too large (filesize), lower the third number image the ImageJPEG function. valid numbers are 1 to 10.
$fn=rand(1,999999999).'.jpg';
header('Cache-control: no-cache, must-revalidate, no-store');
header('Cache-control: pre-check=0, post-check=0',false);
header('Content-type: image/jpeg');
header('Last-modified: '.gmstrftime("%a, %d %b %Y %H:%M %S GMT",(time()+(365*86640)));
header('Expires: '.gmstrftime("%a, %d %b %Y %H:%M %S GMT",(time()+(365*86640)));
header('Pragma: no-cache);
ImageJPEG($im,$fn,10);
unlink($fn);
?>
Hope this helps.
Bookmarks