请求Facebook个人资料图片以及其他信息



我正在使用JS SDK,用户使用FB登录后,我想请求电子邮件,名字,姓氏和图片(指向图片的链接)。/p>

这有效:

FB.api('/me?fields=email,first_name,last_name',
  (graph_response) ->
    ...
)

这也有效,但是我得到的图片超级(如果我在/me/picture请求type=square):

FB.api('/me?fields=email,first_name,last_name,picture',
  (graph_response) ->
    ...
)

我知道我可以得到更大的个人资料图片(足够大):

FB.api('/me/picture?type=large&redirect=false',
  (graph_response) ->
    ...
)

有没有一种方法可以在一个请求中结合两者?我尝试过没有运气的/me?fields=email,first_name,last_name,picture&type=large

这有效:

/me?fields=email,first_name,last_name,picture.type(large)

另外,您可以指定大小:

/me?fields=email,first_name,last_name,picture.width(100).height(100)

更多信息:https://stackoverflow.com/a/27006154/757508

最新更新