Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- function flickr_feed(flickrID, flickr_count, photo_size) {
- var flickrAPI = '12a49355728ae8a0baa555cb07bcb767';
- var getSize;
- if (photo_size == 'square-1') getSize = 'url_sq';
- if (photo_size == 'square-2') getSize = 'url_q';
- if (photo_size == 'thumbnail') getSize = 'url_t';
- if (photo_size == 'small-1') getSize = 'url_s';
- if (photo_size == 'small-2') getSize = 'url_n';
- if (photo_size == 'medium-1') getSize = 'url_m';
- if (photo_size == 'medium-2') getSize = 'url_z';
- if (photo_size == 'medium-3') getSize = 'url_c';
- if (photo_size == 'large') getSize = 'url_l';
- if (photo_size == 'original') getSize = 'url_o';
- $.ajax({
- url: 'http://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key=' + flickrAPI + '&user_id=' + flickrID + '&per_page=' + flickr_count + '&page=0&extras=' + getSize + '&format=json&jsoncallback=?',
- type: 'GET',
- dataType: 'jsonp',
- timeout: 5000,
- cache: false,
- success: function(data) {
- $.each(data.photos.photo, function() {
- var photoURI = 'http://www.flickr.com/photos/' + flickrID + '/' + this.id;
- var photoSrc = this.getSize;
- console.log(photoSrc);
- var photoTitle = this.title;
- var flickr_html = '<div class="flickr-photo"><a href="' + photoURI + '" title="' + photoTitle + '" target="_blank"><img src="' + photoSrc + '"></a></div>';
- $('#flickr-photos').append(flickr_html);
- });
- },
- error: function () {
- $('#flickr-photos').append('<p>Flickr’s API service is experiencing some technical difficulties. Please try again later.</p>');
- }
- })
- }
- flickr_feed('28634332@N05', 10, 'square-1');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement