Facebook 照片 API

发布于 2024-12-13 15:42:23 字数 169 浏览 1 评论 0原文

我在尝试使用 facebook 的 Javascript API 时遇到了严重的问题。我目前有一个功能正常的 Facebook 登录,我希望能够从当前用户获取所有照片,并将它们显示在条带中。我对 Javascript 还很陌生,所以我想知道是否有人已经让它工作了,或者什么是实现这一点的最佳方法,最好不使用已弃用的 FQL。

I am having serious issues trying to use the Javascript API for facebook. I currently have a somewhat functioning facebook login, and I want to be able to get all of the photos from the current user, and have them displayed in a strip. I am pretty new to Javascript, so I was wondering if somebody has gotten this to work, or what would be the best way to accomplish this, preferably without using the deprecated FQL.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最冷一天 2024-12-20 15:42:23

FQL 查询有 5000 个项目限制,但这应该涵盖您想要获取的大量照片:

var query = 'SELECT src_big FROM photo WHERE aid IN(SELECT aid FROM album WHERE owner = me())';

FB.api('fql', {'q': query}, function(res) {
    console.log(res.data);
});

然后您可以循环该结果集并将照片添加到文档中(在此示例循环中使用 jQuery:

var body = $(document.body);

for(var i in res.data) {
   body.append('<img src="' + res.data[i].src_big + '" />');
}

There is a 5000 item limit for FQL queries, but that should cover a good amount of the photos you are looking to get:

var query = 'SELECT src_big FROM photo WHERE aid IN(SELECT aid FROM album WHERE owner = me())';

FB.api('fql', {'q': query}, function(res) {
    console.log(res.data);
});

Then you can loop through that result set and add the photos to the document (using jQuery in this sample loop:

var body = $(document.body);

for(var i in res.data) {
   body.append('<img src="' + res.data[i].src_big + '" />');
}
甜宝宝 2024-12-20 15:42:23

我将从这两个资源开始。 JavaScript SDK 包含 Graph API 的所有功能,其中照片信息是核心部分。

I'd start with these two resources. The JavaScript SDK includes all the features of the Graph API of which photo information is a core piece.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文