I did this in the way 'The script is the image'
declare the script-output as image ( png is my favorite)
(MakePNGCacheFileName is a routine wich you must provide
)
Code:
$guid="a fantasy string" ;
header("Content-type: image/png");
$PNGfile=MakePNGCacheFileName($guid.$theme."X".$sizeid."X") ;
header('Content-Disposition: inline; filename="'.basename($PNGfile).'"') ;
header("Last-Modified: ".gmdate("D, d M Y 00:00:00")." GMT");
header("Expires: ".gmdate("D, d M Y 00:01:00", time()+86400)." GMT") ;
this is followed by a caching instruction to control serverload
Code:
if(true) //Cache ON/OFF Control
{
if (is_file($PNGfile))
{
readfile($PNGfile);
return(0);
}
}
process the image through the GD-Lib
and send the image out / save a copy for the cache
Code:
imagepng($image);
imagepng($image,$PNGfile);
imagedestroy($image);
If you use time-functions in your MakePNGCacheFileName you can control
how often the image is calculated.
The values of $theme and $sizeid wich are passed to my MakePNGCacheFileName function are results of url-parameters wich in your case could be the playername.
Note that the directory for the image output must be write enabled for the webserver process.
In my case the cleaning of old images is done by a cron-job
The script is then embedded in the (HTML) <img> tag: <img src="myscript.php" ...
Good luck
Bookmarks