Facebook Graph API Change: Picture type (size) no longer working?
According to Facebook's Graph API documentation (here), you can access various sizes of a user's profile picture through URLs such as:
You'll notice that the first resolves to a url ending in _t.jpg (the small thumbnail) and the second ending in _n.jpg (the large image). So far so good. Equivalently, we should be able to query for these images like this:
This latter format worked as expected for many months, until just a few days ago when it suddenly started ignoring the "type" parameter entirely - everything now resolves to an image ending in _q.jpg, which is the default if no "type" is specified. As a result, I can no longer figure out a way to query for the large image in PHP (my real problem). It used to work like this:
$pic = $facebook->api('/me', array('fields' => 'picture', 'type' => 'large'));
...but as described above, "type" has spontaneously started being ignored. I've spent several hours scouring their documentation but haven't been able to find any reference to what has changed, or the "new" way this should be done - any pointers would be hugely appreciated...
None of the following work, either (returns nothing):
$pic = $facebook->api('/me/picture', array('type' => 'large')); $pic = $facebook->api('/(my_uid)/picture', array('type' => 'large')); $pic = $facebook->api('/me/picture/?type=large'); $pic = $facebook->api('/(my_uid)/picture/?type=large');
Basically, since Facebook broke things a few days ago there doesn't seem to be any way to get a non-default picture size from PHP. You can try out some of the calls yourself from the Graph API Explorer (here).
Other related/relevant links:
You must request the API with the field_expansion syntax
These api requests works :
$results = $facebook->api('/me', array('fields' => 'picture.height(300).width(300)'));
$results = $facebook->api('/me', array('fields' => 'picture.type(large)'));
This works for me:
I found a workaround - profile pictures of various sizes can still be accessed via an FQL query:
$pic = $facebook->api(array('method'=>'fql.query', 'query'=>"SELECT pic_big FROM user WHERE uid=$fb_uid"));
("pic_big" is equivalent to "type=large" - see here).
This still doesn't explain why the GRAPH call suddenly broke though, or why image sizes don't seem to be accessible via Graph at all anymore (which I'd still like to know)...but at least there's some way to get the other size photos.
Gotta love Facebook and their top-notch reliability...