Posts

Showing posts from August, 2008

My solution for image thumbnails in PHP

A very common dilemma I come across as a PHP developer is how I want to handle creating thumbnails for lots of images. Sure, I could use some software and make thumbnails, but I'm talking about bigger projects that need to handle it for thousands of photos. I have been down the path many times of using PHP GDI+ and writing a function to do resizing. A couple of years ago I got fancier and made some proportiate resizing functions so that those pesky pictures people take holding their cameras vertically don't have to be squished into a pre-determined width of 100px. However, each and every time I do a project like this I always think how messy it is. If you have 50 thousand photos, you will have 100 thousand files once you pre-make all those thumnails. And what if the client comes back next year and wants a different size, or you decide to do something in-between sizes for another use? Heck, what if you update a photo, you have to reme