Flickr hacking

Christian Heilmann is at it again posting an entry about a neat method of grabbing Flickr photos without having to using the Flickr API: Here you'll learn how to get Flickr photos into your JavaScript solutions without having to resort to using the full API. As this is a hack you will only get the […]

Christian Heilmann is at it again posting an entry about a neat method of grabbing Flickr photos without having to using the Flickr API:

Here you’ll learn how to get Flickr photos into your JavaScript solutions without having to resort to using the full API. As this is a hack you will only get the latest 20 photos, if you need more detailed data like restricted to sets or more at once you’ll need to resort to the flickr API.

I went ahead and used his code to create a small demo and it worked like charm. Obviously, the results are unformatted but with a little help from jQuery, Ext, Prototype or YUI, you can certainly add effects to make the layout much nicer.

Here’s the code. It’s small and concise:

<script>
function jsonFlickrFeed(o){
  var i=0;
  while(o.items[i]){
    document.write('<img src="' + o.items[i].media.m + '" alt="' + o.items[i].title +'">')
    i++;
  }
}
</script>
<script src="http://api.flickr.com/services/feeds/photos_public.gne?tags=hackdayindia&lang=en-us&format=json"></script>

Flickr, Script, Java, JavaScript, Hack, Code