Slideshow Pro, Flickr API, PHP and Flash – A Great Combination

DefaultComments Off on Slideshow Pro, Flickr API, PHP and Flash – A Great CombinationPosted on June 5, 2006 by:
in Default

I just finished putting up a gallery of photos of my new son Owen, my wife Melissa and a bunch of other family members that I have taken over the last few weeks. I had contemplated how best to handle a large image gallery on my server, and meet the following goals:

  • Get it up quickly
  • HTML and Flash versions
  • Easy to upload/administrate
  • Optimized use of my remaining server space
  • Have the UI and images appear within the context of my domain/URL

I am in the middle of migrating my existing accounts with Mediatemple to some newer packages with more space, currently most of my server is dedicated to client files, so I didn’t have a lot of room for images until the migration is complete. So I decided to use one of three different photo services I have accounts with: Parazz (formerly Shutterbook), Kodaks KodakGallery (formerly OFoto) and Yahoo’s Flickr. Of the three Flickr has a documented API so I went with it for my temporary solution. Parazz has an really easy to parse XML format for users and galleries, and I’ve got a mobile Flash Lite app working on top of it, but since they don’t publish or publicly document their API or XML format, it could break at any time, so that was out, and I don’t know of anything but hacks for KodakGallery, which is really a walled-garden designed to promote sales of their other offerings. They really should consider opening it up – i would certainly use the WiFi features of my Flash Enabled Kodak EasyShare-One more often if they had an open API.

Last night I uploaded a bunch photos to my photoset of my son Owen on my Flickr account with a great batch upload tool for Mac OS X and Flickr. I was able to quickly tag everything and optimize my images prior to upload to save on my free monthly upload quota. (I haven’t doled out for a Pro Flickr account yet, but now I probably will). Once the images were up, I started whipping up some PHP scripts for the HTML portion. This was fairly easy thanks to a great PHP library phpFlickr. phpFlickr makes it really easy to consume the Flickr API in PHP. It does require some elements of the PEAR library to be installed, and some of those elements require PHP 4.3.0 or greater, which on my current server I don’t have installed, but I was able to use some pieces of the PHP_Compat library of PEAR to get things working really quickly. the PHP_Compat library emulates a lot of functions and features of newer versions of PHP for older versions of PHP, its saved my bacon a few times in the past year or so. Once I had phpFlickr going it was pretty easy to customize one of the included examples to fit my needs. I wanted a page that would retrieve and cache links to all the thumbnails and full size images of my Owen Martell Hall photoset. I also wanted the descriptions and titles in the alt tags for the images. It took me just a few minutes to get that working, and then I used some JavaScript to have the links popup a small window that passes through a link to the full size image on Flickrs servers. It works great, and the built in cacheing methods of phpFlickr are pretty good, giving you an option of either local file cacheing or a MySQL based cacheing mechanism. I went with local file DB just to get things going, and will probably switch to the MySQL method when I’ve tweaked things a bit more. It actually made it easier to understand what phpFlickr was doing when I could look at the local .cache files during the PHP coding.

This brings me more than halfway done, as I’ve met all the goals in my bullet list, except for having a Flash version. I’ve built a number of image galleries in Flash over the years, but I didn’t feel like starting one from scratch right now, I just wanted to get something working as quickly as possible. So instead of re-creating the wheel, I purchased a copy of Todd Domineys excellent Slideshow Pro component. Purchasing it was a snap through Paypal, and it was only $20 bucks, well worth the money. He also has a new very cool CMS management tool to compliment things, Slideshow Pro Director – for me I can’t use that yet till I am migrated to my new server which supports PHP 4.3.0 or higher. This wasn’t much of an issue for me though as I planned on using Flickr anyway. Todd actually has links to some great scripts in PHP that also use the phpFlickr framework to consumer Flickr API’s and build the required XML feeds that his Slideshow Pro component use. The fact that I had just played around with phpFlickr made this a no brainer, and I was able to use FlickrSSP with just minor modifications. I once again had to use the PEAR PHP_Compat library for a couple functions on my older PHP install in order to get things working, but after that it was a cinch.

I finished things off by making adding a link to the Flash Slideshow Pro version on the HTML page, and incorporated Geoff Stearns SWFObject and ExpressInstall features to finalize everything. I also dropped in an appropriate music track of the Flaming Lips, “Do You Realize” from Yoshimi Battles the Pink Robots, into the XML for Slideshow Pro. There is plenty of room for improving the presentation and aesthetics of how I incorporated this into my site, but for only a couple hours of work, and free hosting thanks to Flickr, you can’t beat this. See the final results here: http://www.impossibilities.com/OwenMartellHall.php and let me know what you think.

PRINT THIS ENTRY

Comments are closed.

This site is available for historical purposes, but is no longer actively updated.
Please visit https://rmhall.org/ in Q3 of 2021 for all the latest and greatest!

X