1

I am using Facebook's PHP SDK and Graph API to obtain all albums from one user, and then display them to him so he can select which album he will browse. I want them displayed in a grid, just like Facebook does: every picture with the same width and height.

The problem is that when I do:

   $fb->api('/' . $album_id . '/picture?access_token=' . $accessToken 

I get a version of the picture with the original dimensions, and not the way that Facebook shows them to you when you click on Photos, i.e. a cropped version adjusted to a fixed size.

I have tried adding ?square to the request, but still getting the same result.

Any ideas?

Manuel Pedrera
  • 5,347
  • 2
  • 30
  • 47

1 Answers1

1

Supported types for albums are thumbnail, small and album and to retrieve one of them you use:

$fb->api('/' . $album_id . '/picture?type=album&access_token=' . $accessToken 
ifaour
  • 38,035
  • 12
  • 72
  • 79
  • Actually I tried with small and got and error. With some testing, I have that for album covers, types are: thumbnail, normal, album; while for regular pictures types are small, normal, large, square. I will test tomorrow at work your solution and see if they get cropped. Anyway, I mark it as solved as this is what I was looking for and I'm sure there is no other way to solve this. Thanks! – Manuel Pedrera Mar 02 '11 at 21:43
  • 1
    @manuelpedrera: I've got the list from Facebook error: `"message": "Unsupported type, 'square'. Supported types: thumbnail, small, album"` :-) – ifaour Mar 02 '11 at 21:50
  • Weird, I got the list from the same source :| – Manuel Pedrera Mar 02 '11 at 21:52
  • @manuelpedrera: lol...I'm not surprised, it's Facebook we are talking about ;-) – ifaour Mar 02 '11 at 21:54