PSD to HTML conversion PSD to HTML conversion PSD2HTML.com with over 300 professionals takes the designs to HTML and beyond

Code Snippet

Home » Code Snippets » jQuery » Show Most Recent Picasaweb Uploads

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

Reference URL

Subscribe to The Thread

  1. elundmark says:

    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. elundmark says:

    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!");

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~