繁体   English   中英

Facebook Graph API获取原始图片大小不起作用

[英]Facebook Graph API get original picture size not working

需要一些帮助,才能使用Facebook Graph API从帖子中获取正常或较大的图像,目前该对象中的图像仅为130 x 130 px。

 function fbFetch() { var access_token = ""; var url = "https://graph.facebook.com/?ids=intel&fields=posts.limit(5){message,created_time,picture.type(normal)}&access_token=' + access_token; $.getJSON(url, function(response) { var messages = []; Object.getOwnPropertyNames(response).forEach(function(page, idx, array) { response[page].posts.data.forEach(function(post, idx, array) { messages.push(post); }); }); function compare(a, b) { if (a.created_time < b.created_time) return -1; if (a.created_time > b.created_time) return 1; return 0; } var html = "<ul>"; $.each(messages.sort(compare), function(i, fb) { if (typeof fb.picture != "undefined") { html += "<li>" + fb.message + "</br>" + '<img SRC="' + fb.picture + '">' + "</br>" + fb.created_time + "</li></br>"; } else { html += "<li>" + fb.message + "</br>" + fb.created_time + "</li></br>"; } }); html += "</ul>"; $('.facebookfeed').html(html); }); } fbFetch(); 
 <div class="facebookfeed"></div> 

在这里提琴: http : //jsfiddle.net/6fhq3dat/17/

使用full_picture而不是picture

var url = "https://graph.facebook.com/?ids=intel&fields=posts.limit(3){message,created_time,full_picture}&access_token=" + access_token;

演示

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM