I'm building some photo gallery pages for a client. Apparently the client will be regularly adding new photo galleries, and some of them will include a fairly significant number of photos.
Sure, I can batch process the images in Photoshop to create the thumbnails and larger images, but the tools available to create the actual galleries leave something to be desired with respect to the time required and the code generated.
So I wrote a little php script that loops through the thumbnails directory and creates a grid of thumbnails, with each thumbnail linking to a popup window of the larger image.
Then I turned the thumbnail-display code into a function, and the popup window with the larger image another function.
Now, I can create new photo gallery pages by simply calling the first function, passing it the name of the directories that contain the thumbnail and large image files. The entire photo gallery is created with one line of php code in my file.
Bada-bing bada-boom -- all the photo galleries the client wants, costing only a few minutes of my time for each one. My client will be happy, because they'll save money. I'll be happy, because I can get my work done faster, and provide faster service for more clients.
I love php.