I’ve been working on a CMS lately and having to create thumbnails for uploaded images is always a pain, lots of maths working out the correct sizes and such, so I’ve created a fairly small script to manipulate images in an object-oriented style.
For example:
scale(400, 300); $image->write('small-image.jpg'); $image2 = new Image('image2.jpg'); $image2->watermark = 'sample.png'; $image2->output(); |
I’ve only implemented a few of the GD library methods, but I think these are the most useful methods. I might have to work on something that rounds the corners too, but I don’t have any need for it just yet.
There’s a demo page as ever, and you can get the script here (It’s a bit big, because the sample image is included, here’s one without it).