Ahmed Shan

www.thaanu.com

Posted on 30th December 2011

Pulling Flickr Photostream using JSON

This is not that tricky, but it took be sometime to figure this out after referring to few websites. One of the website is viget.com.

Things to keep in mind

  • You have to change the Flickr photostream RSS URL like the following

    http://api.flickr.com/services/feeds/photos_public.gne?id=35266478@N06&lang=en-us&format=json&jsoncallback=?

  • Create a div container for all the pictures to drop in. In my case I’m using ‘#content’.

Source Code

var linked = "<your flickr rss url>";
$.getJSON(linked, function(data){
$.each(data.items, function(i, item){
$("<img/>").attr("src", item.media.m).appendTo('#content')
.wrap("<a href='"+ item.link +"' class='close' rel='"+item.media.m+"'>");
});
});

Comments

Powered by Facebook Comments

Tags: ,