What would be the best practice way to handle the caching of images using PHP.
The filename is currently stored in a MySQL database which is renamed to a GUID on upl
phpThumb is a framework that generates resized images/thumbnails on the fly. It also implements caching and it's very easy to implement.
The code to resize an image is:
will give you a thumbnail of 200 x 200;
It also supports watermarking.
Check it out at: http://phpthumb.sourceforge.net/