April 29, 2008

Photo hunt

In the last four years, I've taken thousands of photos. I'd say maybe eight of them have descriptive names like "kevin_saves_dolphins.jpg" or "kevin_receives_key_to_city.jpg", so finding particular ones later is a big pain. (Did I file that photo of my parents and Amy's parents under "Cooney," "Gawelek," or "Funny Looking People"?). To compound the issue, I don't believe in the delete button, so bad photos are constantly showing up in our various slideshow programs (screensavers, digital picture frames, etc).

What I needed was a good way of labeling photos for easy retrieval later. Flickr does a great job with this by allowing users to "tag" photos. But I wanted to do this on my computer, so I'm not dependant on Flickr. Also, Flickr ain't free for large amounts of uploads (as would likely be the case for me). And for Pete's sake they can't even spell, how can I trust them with my precious family memories?

Picasa also has a way to tag photos, which wouldn't require uploading all my photos, but I'm not a huge fan of Picasa, due to its "What happens in Picasa, stays in Picasa" attitude. On the one hand, it's great that the original photo is always available, but sometimes I like to view photos outside of Picasa, which won't show those edits.

Then there's the big problem: I just don't have the discipline to sit down and tag photos, or the memory to remember to do it regularly. I think most families have two nicely organized photo books, and then 10 shoeboxes filled with piles of photos (or even just film canisters). If this was going to work, it had to be futureproof.

Then last year, I was getting an MRI (don't worry, I'm fine), so I had about an hour of staring at the ceiling to think about the situation. I had an insight: If I set my browser's homepage to a page that picked a photo at random and allowed me to tag it, I'd get through a few a day, and slowly tag my entire collection.

I already had my photos available from a webserver in my house, and I use a photo album program called phpAlbum, which can read these types of tags and search for them. So all I needed to do was write the program to allow me to insert the tags, and I'd be all set. So that's what I did.

I wrote it in PHP, using The PHP JPEG Metadata Toolkit, a library that can read and update the IPTC header of JPEG photos (a fancy way of saying it can edit tags within photo files). The tags get saved within the file itself, so if I ever switch computers, or systems, the tags will still be there.

Tags are entered as a comma-delimited list, like so:

Once saved, they can be searched for using phpAdmin:


It's been set as the homepage of our home computer for about two months now, and we've tagged about 30% of our photos. In addition to tags like "kevin" or "amy," we've also started using more abstract tags like "favorite" or "funny," which give some great sets of photos. Also, I've been using some practical tags like "rotate" or "redeye" so if I'm ever feeling motivated, I can easily find photos that need fixing.

The next step will be to build a process to generate lists of photos to be used for slideshows based on search results. For instance, if my family comes over for dinner, I'd like to only have family-related photos on my digital picture frame.

For the nerdly-inclined, the source code is here. It's not what I'd call "good" or "correct syntax", but it gets the job done.

Posted by Kevin at April 29, 2008 08:38 PM

That is way over my head..

Posted by: Bizz at May 13, 2008 08:42 PM
Post a comment

Remember personal info?