Show Most Recent Picasaweb Uploads

Replace the "tester" username below with your own, and the target value with the selector of the element you wish to append the pictures to.

$(document).ready(function() {
	$.getJSON("http://picasaweb.google.com/data/feed/base/user/tester/?kind=photo&access=public&alt=json&callback=?",
	function(data) {
		var target = "#latest-picasaweb-images ul"; // Where is it going?
		for (i = 0; i <= 9; i = i + 1) { // Loop through the 10 most recent, [0-9]
			var pic = data.feed.entry[i].media$group;
			var liNumber = i + 1; // Add class to each LI (1-10)
			var thumbSize = 0; // Size of thumbnail - 0=small 1=medium 2=large
			$(target).append("<li class='no-" + liNumber + "'><a title='" + pic.media$description.$t + "' href='" + pic.media$content[0].url + "'><img src='" + pic.media$thumbnail[thumbSize].url + "' /></a></li>");
		}
	});
});

Example

Comments

  1. User Avatar
    elundmark
    Permalink to comment#

    Since writing and using this for a while, I’ve noticed that it doesn’t exactly fetch the Absolutely latest images, more like representative images, like 1 of the 5 you uploaded at once last.

    But it’s the same thing with their rss-feed, so I guess it’s a Google-thing in general, and who could blame them. No way no how they could keep absolutely accurate Live feeds for every photo at once…

  2. User Avatar
    elundmark
    Permalink to comment#

    If you want to show how many images you have, try this:

    // Assumes you have the json feed for your entire account, and not just a specific folder - I guess if you use that you'll get the amount in your folder, but I'm just guessing
    
    $.append("I have " + data.feed.openSearch$totalResults.$t + " photos online!");
    

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag