Twitter

Recent Comments

Greg's Photos on Flickr



What I'm Listening To...



Using Flickr's API and a PHP script to create Atom RSS feeds of entire Flickr PhotoSets


I recently picked up one of the fire-sale HP TouchPads. It's pretty damn useful and with full screen flash video gives the iPad a (short) run for its money. One of the uses I wanted to purpose it for was to act as a digital photo frame when not in use. The TouchPad comes with a photo management/slideshow tool as one of its native applications however you either have to copy the photos onto the device or hope that your images are on a service like Facebook that syncs with the TouchPad using the fantastic Synergy services. All my images are on Flickr and as yet there is no Synergy Service for Flickr.

I then started looking for an app that would help me do what I wanted. I downloaded an app called Flickr Mundo HD but was disappointed to find that it would not allow me to display slideshows of individual Flickr PhotoSets. Aside from that its a great app for browsing and using Flickr.

I then found an app called SlideRSS which performs the single task of taking an RSS feed of images and displaying them as a slideshow! "Problem solved!" I thought. I loaded up the Flickr RSS feed of my Project 365 PhotoSet and was disappointed to see that only the last 20 photos were pulled down. This appears to be a restriction of the Flickr RSS feeds.

So I started thinking. I knew Flickr has a great API and recently I have been working with a lot of pseudocode. So trying to code something to solve this problem was something I thought I would be capable of. Off to google I went to investigate Flickr's API.

The Flickr API documentation
is good but does not really provide a beginners guide to the service. However I soon found this page from Kyle Rush which gives a nice step by step guide of how to make an API call and what is returned. Armed with this I was ready to start coding.

As the returned API call is in XML I figured I could call it into a PHP script and then scrape the attributes of each photo and output a RSS feed with an entry for each of the photos. I came up with this code.


What it does is pull the returned XML in then it cycles through each of the photos and creates an Atom XML entry for each individual photo. The API call does not return the URL for the photo but instead provides you will all the information required to build the URL. As you can see. All I did then was load the file up to my web server and pointed SlideRSS at its URL and I had all my photos displaying on my TouchPad!

That was my first ever piece of PHP code, and I was rather happy with it! But then I got to thinking that I have a LOT of PhotoSets. I could do with some way of merging some of them into a single feed. So I put my mind to figuring out some way of pulling in multiple feeds and creating an RSS entry for each of the photos in ALL of the feeds. This is what I eventually came up with after much head scratching and conferences with my mate Dunc.


I now have all my Flickr photos on my TouchPad slide-showing away whenever I want them. And the great thing is that if I add more images to the sets then they will also be pulled down as these scripts are dynamic!


Powered by Drupal Discovered in Southport