douxian1923 2014-05-11 07:00
浏览 70

如何嵌入来自Flickr的图像,以便在网站上显示图像?

I was wondering how I could embed pictures from FLICKR onto the website, right now, I can only get the URL's of the image, but I wanted to get the whole image with it. Here is my code:

<!DOCTYPE html>
<html>
<head>
  <script src="jquery-min.js" type="text/javascript"></script>

  <script type="text/javascript"> 

$(document).ready(function() {
    API_KEY = 'YOURAPIKEY'; //INSERT API KEY
    USER_ID = '28858578@N06'; //ENTER USER ID

    var photolist = [];

    $.getJSON('https://www.flickr.com/services/rest/?method=flickr.people.getPhotos&api_key=' + API_KEY + '&user_id=' + USER_ID + '&format=json&jsoncallback=?', function(rest) {

        var numPhotos = rest.photos.pages;

        for (var u =1; u < numPhotos + 1; u++) {    
            $.getJSON('https://www.flickr.com/services/rest/?method=flickr.people.getPhotos&api_key=' + API_KEY + '&user_id=' + USER_ID + '&format=json&page=' + u + '&jsoncallback=?', function(results) { var targetDiv = $('#fotolist')
                for (var m =0; m < results.photos.total; m++) {
                  targetDiv.append("https://www.flickr.com/" + 
results.photos.photo[m].owner + "/" + results.photos.photo[m].id + "<br />");
                    photolist.push("https://www.flickr.com/" + results.photos.photo[m].owner + "/" + results.photos.photo[m].id);


                }      
            });
        }    
    }); 
});
  </script>


</head>
<body>
<div id="fotolist">
</div>
</body>
</html>
  • 写回答

1条回答 默认 最新

  • dornc9470 2014-05-11 07:24
    关注

    if photolist contains array of links of images

    var fotolist = $('#fotolist');
    jQuery.each(photolist , function(index, value){
     fotolist.append('<img src="'+value+'">');
     });
    
    评论

报告相同问题?

悬赏问题

  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch