Skip to content

Instantly share code, notes, and snippets.

@jasonmelgoza
Created April 20, 2010 16:54
Show Gist options
  • Save jasonmelgoza/372743 to your computer and use it in GitHub Desktop.
Save jasonmelgoza/372743 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
function flickr_feed(div,id,size,amount,tag,set) {
/**
*
* Get your ID from here: http://idgettr.com
*
* Size options are:
* b=big (1024px)
* m=medium (240px - default)
* s=square (75x75px)
* t=thumbnail (100px)
*
**/
var feed = (set) ? "photoset.gne?nsid="+id+"&set="+set : "photos_public.gne?id="+id;
var tag = (tag == null) ? "" : tag;
var amount = (amount == null) ? "20" : amount;
var size = (size == null) ? "m" : size;
$.getJSON("http://api.flickr.com/services/feeds/"+feed+"&tags="+tag+"&format=json&jsoncallback=?",function(data){
$("#"+div).html("");
$.each(data.items,function(i,item){
if(i<amount) {
$("<img/>").attr("src",item.media.m.replace("_m","_"+size)).appendTo("#"+div).wrap("<a href='"+item.link+"'></a>")
}
});
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment