Archive for the ‘php’ Category

Random Picture from Picasa

Saturday, November 3rd, 2007

I have hacked together some PHP5 code to get a thumbnail of a random picture from Picasa Web Albums for a given userid.

The code can be much better. Each time the page is requested two curl calls are made, one to fetch XML for the albums and one to fetch the XML of the pictures of the randomly selected album. But it does works and you get a random picture.

I can think of some ways to speed it up, but I am not sure how or even if I will implement this on the site in any way so I’m going to hold off on any optimization until it’s needed.

Many thanks to Philipp Lenssen for the post at Blogoscoped as he did the heavy lifting when it came to using an xpath query to get data from those Google XML feeds.

See it Work!
View Source