Saturday, August 8, 2009

Embed a random Picasa Web Albums Picture in your Website

If you would like to embed a random picture from your Picasa Web Albums account into your web pages just put the following snippet:

<script src="http://rndpic.appspot.com/user/your.username" type="text/javascript">
</script>
Replace "your.username" with your actual user name.


The picture is clickable and the link takes you directly to the picture hosted on Picasa Web Albums.

Update: 9/14/2009
Due to a Bug in Google App Engine, contents of large albums (>~300 pictures) cannot be displayed properly at the moment.

Update: 3/25/2010
Thanks to partial responses the script now also supports showing albums with 400 or more photos.

Update: 1/16/2011
I finally uploaded the project to Google code. Check it out at https://github.com/pmoor/rndpic. In addition, I added the ability to specify custom sizes for the thumbnails as well as the option to turn off the link generation.