你能在一个API请求中提取多个Facebook个人资料图片大小吗?

时间:2015-06-03 14:26:42

标签: facebook facebook-graph-api graph

您可以使用图形api指定个人资料图片的大小:

/me?fields=picture.type(square).width(638).height(638)

但有人知道如何在一个API请求中提取多个尺寸吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

我不相信这可以通过API实现。如果您知道图片ID,那么您可以做的是:

GET /{PROFILE-PIC-ID}
{
  "id": "XXX", 
  "created_time": "2014-09-03T20:43:08+0000", 
  "from": {
    "id": "XXX", 
    "name": "XXX"
  }, 
  "height": 720, 
  "icon": "XXX", 
  "images": [
    {
      "height": 914, 
      "source": "XXX", 
      "width": 914
    }, 
    {
      "height": 720, 
      "source": "XXX", 
      "width": 720
    }, 
    {
      "height": 600, 
      "source": "XXX", 
      "width": 600
    }, 
    {
      "height": 480, 
      "source": "XXX", 
      "width": 480
    }, 
    {
      "height": 320, 
      "source": "XXX", 
      "width": 320
    }, 
    {
      "height": 540, 
      "source": "XXX", 
      "width": 540
    }, 
    {
      "height": 130, 
      "source": "XXX", 
      "width": 130
    }, 
    {
      "height": 225, 
      "source": "XXX", 
      "width": 225
    }
  ], 
  "link": "XXX", 
  "picture": "XXX", 
  "source": "XXX", 
  "updated_time": "2014-11-25T10:05:11+0000", 
  "width": 720, 
  "comments": {
    "data": [
      ...
    ], 
    "paging": {
      ...
    }
  }, 
  "likes": {
    "data": [
      ...
    ], 
    "paging": {
      ...
    }
  }
}

但是这也意味着:

  • 您需要user_photos权限
  • 您需要拨多个电话(例如/me/albums ...等)才能获得个人资料图片ID。