Shashin – A WordPress Plugin for Displaying Picasa Photos – First Cut
I haven’t posted recently, but that doesn’t mean I haven’t been working on my blog.
I’ve completed a first-cut version of a plugin for displaying Picasa photos in WordPress. I just tested it with Post to Post Links II error: No post found with slug "lews-wedding" if you want to see. I named it Shashin (pronounced sha-sheen), which is Japanese for photograph. I started working on it while I was in Japan, so I thought it deserved a Japanese name, and shashin sounds cool.
The mPicasaIntegration plugin I’ve been using so far has some real drawbacks. One is that it copies down the pictures from Picasa to your web server, so you’re eating up disk space (to be fair, the author did this because he was concerned at the time about what was allowed under the Picasa user agreement, but it’s pretty clear now Google is happy to let folks re-display their Picasa images). You also can’t adjust the size – every image is 640×480. In contrast, my plugin displays the images directly from Picasa, which means once I move all my pictures from my old Coppermine installation to Picasa, I can get an account for my site with a lower disk quota, and a smaller monthly bill 😉 . Also, Shashin can display images in any of the 17 sizes supported by the Picasa API. Picasa’s on the fly scaling is pretty good – much better than the browser scaling I had to use with mPicasaIntegration.
I’ve also given it some nice display options – you can choose to have the photo link to the Picasa image, and optionally display the photo description as a caption (I eventually gave up on finding the “correct” way to caption an image in xhtml and just went with a div set to block display). Getting the xhtml to work the way I want has been driving me crazy though, due to WordPress’ autoformatting. For example, WordPress sticks a line feed and a break tag between nested divs, even if there’s no line break in my code. I set the priority of my content filter to the maximum level, to try overriding the autoformatter, which helped with some problems, but not all of them.
I’m not quite ready to share it yet, mainly because I don’t have an admin page done yet for the photo table (I’m parsing the Picasa RSS feed on demand and then syncing it to local tables). I’d also like to offer some options beyond just displaying single images…I hope to be able to invite folks to beta test in a couple weeks.
I spent a fair amount of time on the architecture of the code. It’s all OO, and I went a bit over the top with the abstraction. That made the setup time longer but is now paying off, as I can add features without having to do a whole lot more coding. I also now have a good foundation of generic functionality for building other plugins (I have another in the works for managing real estate listings, for my dad).