graphics/image disk cache - graphics_cache

From: Date: Sun, 28 Jan 2001 19:03:11 +0000
Subject: graphics/image disk cache - graphics_cache
Groups: php.pear 
Request: Send a blank email to php-pear+get-1208@lists.php.net to get a copy of this message
Hi, I've a little widget class to cache the output of ImageGIF() & friends and I would like to know if you want to see it in PEAR. Why? Most acticles on dynamic image creation tell people to write a script image.php that takes some parameters and returns an image so that you can write something like '<img src="image.php?text=demo">'. Well, this is a perfect way to kill your webserver: every image starts a new php process. The solution is simple. Generate the images by the script that prints the image tags and save the images to disk, so that your tags look like '<img src="aha74683473.png">'. How does it work? The graphics_cache class take an image resource handle (returned by ImageCreate()) and an ID, checks if the image already exists or creates a new image file and returns the image. createImage() returns the image stream and createImageLink() returns an array with the URL of the image and it's absolute file path. Where... ... is the source? http://www.redsys.de/graphics_cache.htm What else? gtext and gbutton need it. Wait for my next posting to see what gtext is. Ulf

« previous php.pear (#1208) next »