Search code examples
jqueryajaxflickr

Flickr image unavailable


Is is impossible to hotlink images from flickr? I get some random public images and try to put them on my website, but it gives just "image unavailable"

$.ajax({
    url: 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key='+key+'&tags=Netherlands&per_page=4&format=json&nojsoncallback=1',
    type: "GET",
    dataType: "json",
    success: function (data) {
        console.log("flickr");
        var flickr = data;
        console.log(flickr.photos.photo);
        for(var j=0; j< flickr.photos.photo.length; j++) {
            $('body').append("<img src=http://farm" 
                            + flickr.photos.photo[j].farm 
                            + ".static.flickr.com/"
                            + flickr.photos.photo[j].server 
                            + "/"
                            + flickr.photos.photo[j].id
                            + "_" + flickr.photos.photo[j].secret+ ".jpg/>"
            );
        }
    },
});

when directly opening the generated link i can see the picture


Solution

  • Ok found it. need to add one extra parameter to the ajax request

    extra

    which can output image address according to site