Flickr set gallery


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



Copy this code and paste it in your HTML
  1. //jquery galeria flickr
  2. $(document).ready( function() {
  3. var Cont = $('<ul>').appendTo('.fotos');
  4. var ifo = {
  5. Api : 'YOUR API ID', //flickr api
  6. Set : '72157612297020622', //foto set
  7. fLink : 'http://www.flickr.com/photos/burgersux/', //link da galeria no flickr
  8. Cant : 2 //qtd de fotos a serem exibidas
  9. };
  10. $.getJSON('http://api.flickr.com/services/rest/?format=json&jsoncallback=?&api_key='+ifo.Api+'&method=flickr.photosets.getPhotos&photoset_id='+ifo.Set+'&per_page='+ifo.Cant, function(Data){
  11. if (Data.stat == "ok"){
  12. for (var i=0; i<Data.photoset.photo.length; i++){
  13. var photo = Data.photoset.photo[i];
  14. var Thum = 'http://farm'+photo['farm']+'.static.flickr.com/'+photo['server']+'/'+photo['id']+'_'+photo['secret']+'_'+'s.jpg';
  15. Cont.append('<li><a href="'+ifo.fLink+photo['id']+'/in/set-'+ifo.Set+'" title="'+photo['title']+'"><img src="'+Thum+'" alt="'+photo['title']+'" /></a></li>');
  16. };
  17. }
  18. });
  19. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.