簡體   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