0

I'am working with iOS and the graph API, i made a table cell to choose between the differente Albums from Facebook. I want the user to choose a photo, and the get the photo url in 400x400 by his ID Like when i get his picture by

https://graph.facebook.com/id.facebook/picture?width=300&height=300

Here is the request :

IDFACEBOOK?fields=id,albums.fields(photos.fields(id))

And here is the result:

{
  "id": "100004371731895",
  "albums": {
    "data": [
      {
        "id": "159236757565381",
        "created_time": "2013-02-28T13:51:13+0000",
        "photos": {
          "data": [
            {
              "id": "159236790898711",
              "created_time": "2013-02-28T13:51:16+0000"
            },
            {
              "id": "159236810898709",
              "created_time": "2013-02-28T13:51:18+0000"
            },
            {
              "id": "159236820898708",
              "created_time": "2013-02-28T13:51:19+0000"
            }
          ]
        }
      },
      {
        "id": "153859634769760",
        "created_time": "2013-02-10T19:27:31+0000",
        "photos": {
          "data": [
            {
              "id": "157894851032905",
              "created_time": "2013-02-23T16:20:18+0000"
            },
            {
              "id": "153859638103093",
              "created_time": "2013-02-10T19:27:31+0000"
            }
          ]
        }
      }
    ]
  }
}

Anyone have an idea on how to proceed ? Thanks in advance. Bye bye !

Kara
  • 6,115
  • 16
  • 50
  • 57
Pierre Lebon
  • 445
  • 1
  • 5
  • 12

1 Answers1

0

In your field expansion, request the images parameter which is "The 4 different stored representations of the photo", each containing height, width, and source fields.

So, the field expansion becomes:

/IDFACEBOOK?fields=id,albums.fields(photos.fields(id,images))

For each photo, use the source with dimensions closest to the height and width you need and then resize the image. There's ton of tutorials for resizing images on iOS, search google.

Tommy Crush
  • 2,790
  • 1
  • 15
  • 18
  • thanks for your anwser, but i don't show them directly on the iphone, i need to store them on my server using php, but some of the picture can't be copied (maybe facebook doesn't allow fopen on them). How to see the difference between those which can be copied ? Thanks ! – Pierre Lebon Mar 24 '13 at 19:44
  • It is against Facebooks TOS to save your own copies of their photos long-term – Tommy Crush Mar 24 '13 at 19:48