« The Showdown: CP vs. KI (Part 2) | Home | Fairbanks Packs House; Records Live Album »
Integrating Picasa Web Albums Into my Site with PHP
By Jonathan | October 28, 2008 at 5:37 pm
I like to think that I take a moderate number of digital photos, and I’m always looking to store them on my computer. I use iPhoto for organization, which I believe is a great application. I’ve always liked to share my photos online with friends and family (and whatever other creeps find the links), but I never could find a solid display method that did what I wanted (thumbnail page, higher res images, etc.). I used Photoshop for a while, which offers some decent page templates and automated creation of thumbnails and high(er) resolution images, but I still had to manually add a link from my page to the album page. I used Dreamweaver for a while, which also offers some decent page templates, but again, I was still stuck manually adding a new link to the new album page. In addition, none of the templates ever matched the template I used for the rest of the site; ie, there was too much manual work required!
I tossed around the idea of writing my own PHP script to pull images from a directory, generate thumbnails, create pages, etc., but it always seemed like too much work and I never got around to doing it. Anything I found online never did “exactly” what I wanted it to do, so I was never happy with any 3rd party solutions.
A while ago I finally gave up with Photoshop and Dreamweaver and decided that I would let Google handle all of my photo albums online. Using Picasa Web Albums has worked out very well, but there was never any integration between Lepolt.com and my Picasa Web page. A couple weeks ago I found out that Google [more or less] provides an API to Picasa Web. This is nothing new, I just had never heard about it. It’s not a direct API, but basically works by reading the XML feed that Google uses to store information about the albums and photos within. After Googling around a little and messing with some code, I finally developed a version that I was happy with.
It can be seen in production here: (http://www.lepolt.com/pictures.php).
For those interested, I will post the final version of my code. Please note that this code carries no warranty.
http://www.lepolt.com/blog/wp-content/uploads/2008/10/getpicasapics.zip
Additional links:
http://www.ibm.com/developerworks/library/x-picasalbum/
http://code.google.com/apis/picasaweb/developers_guide_protocol.html
Update: See this link for an updated version of the code for use as a WordPress plugin
Topics: code, do it yourself, google, review | 13 Comments »

October 28th, 2008 at 6:36 pm
I not only gave you the idea for using the XML from Google, but sent you both of those links. Where’s my credit?
October 28th, 2008 at 6:56 pm
I’d be more than happy to post your email address on the Internet!
October 29th, 2008 at 12:28 pm
I measured the load time of that page with a sun dial.
October 29th, 2008 at 8:19 pm
Sorry, in order to generate the random thumbnail images I cache the list of thumbs for each album in local cache files on the web server. The file I/O is the slow stuff…and if the cache file needs to be updated a new file needs to be created which will add some additional computation. All I have to say is it’s better than any PHP script on the web I’ve ever seen from you!
October 29th, 2008 at 10:53 pm
How often are the cache files for each album created?
October 30th, 2008 at 7:32 am
Cache files are created each time a new album is created and whenever the timestamp for an album changes.
November 3rd, 2008 at 9:43 am
Where are all the photos of me?
November 3rd, 2008 at 4:07 pm
[...] Picasa Web Album PHP Widget [...]
November 4th, 2008 at 6:11 pm
Where’s the friendly user guide to go with your zip file???
November 15th, 2008 at 3:30 pm
[...] Integrating Picasa Web Albums Into my Site with PHP [...]
November 15th, 2008 at 3:32 pm
The code has been modified for use as a WordPress plug.
See here for details.
November 16th, 2008 at 4:23 am
I have been playing with this code for hours. Everything drills down through the XML until it needs to write to the Cache file. It creates them fine but they are empty. Resulting in no thumbnails. Everything else works.
Do you know what could cause this?
Thanks Lance
November 18th, 2008 at 11:21 am
[...] colleague Johnathan has written a post discussing how to retrieve Picassa content with PHP and has also written a WordPress plugin for this purpose. Check them [...]