Show Most Recent Flickr Uploads


/ Published in: JavaScript
Save to your folder(s)

This code will display the most recent uploads from Flickr for any account. Replace the “35591378@N03″ (the Whitehouse account) in the code below with the ID of the account you are fetching from. Use http://idgettr.com/ if you need help finding it. Alter the “9″ in the loop to show more or less than 10.


Copy this code and paste it in your HTML
  1. $(document).ready(function() {
  2. $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=35591378@N03&format=json&jsoncallback=?", function(data) {
  3. var target = "#latest-flickr-images ul"; // Where is it going?
  4. for (i = 0; i <= 9; i = i + 1) { // Loop through the 10 most recent, [0-9]
  5. var pic = data.items[i];
  6. var liNumber = i + 1; // Add class to each LI (1-10)
  7. $(target).append("<li class='flickr-image no-" + liNumber + "'><a title='" + pic.title + "' href='" + pic.link + "'><img src='" + pic.media.m + "' /></a></li>");
  8. }
  9. });
  10. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.