使用图表API在投资组合网站上从Facebook相册显示图像 [英] Displaying images from Facebook photo albums on a portfolio site using the graph api

查看:102
本文介绍了使用图表API在投资组合网站上从Facebook相册显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户希望能够通过在她的Facebook帐户上添加相册来更新她的网站的图片库。这是否可能使用JSON?她选择显示的专辑是否需要公开?感谢您的任何帮助!

A client of mine would like to be able to update her site's image galleries by adding images to albums on her facebook account. Is this possible using JSON? would the albums she chose to display need to be made public? Thanks for any help on this!

推荐答案

这是绝对可能的使用图表api:

This is definitely possible by using the graph api:

获取所有相册的ID - 选择所需的相片:

Get the ID of all of her albums - select the one you want:

https://graph.facebook.com/me/albums/

访问相册:

https://graph.facebook。 com / ALBUM_ID / photos

您需要user_photos权限,并且该相册需要公开。

You need the user_photos permission and the album needs to be public.

这将返回以下JSON格式的所有照片的列表:

This returns you a list of all the photos in the following JSON form:

{
          "id": "104988432890979",
                 "from": {
                    "name": "Patrick Snape",
                    "id": "100001394674670"
                 },
                 "picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc4/hs272.snc4/39934_104988432890979_100001394674670_46790_6171664_s.jpg",
                 "source": "http://sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs272.snc4/39934_104988432890979_100001394674670_46790_6171664_n.jpg",
                 "height": 540,
                 "width": 720,
                 "link": "http://www.facebook.com/photo.php?pid=46790&id=100001394674670",
                 "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif",
                 "created_time": "2010-08-11T10:32:45+0000",
                 "updated_time": "2010-08-11T10:32:47+0000"
              }
}

然后,您可以使用照片的来源获取全尺寸的图像

You can then use the source of the photo to get the full sized image

这篇关于使用图表API在投资组合网站上从Facebook相册显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆