I am using the PHP SDK through Batch Request (so that its faster to get the covers of all the albums). Its working fine, but the pictures I am getting are not the album covers but the individual pictures in the various cropped sizes.
$albums_resp = $facebook->api('/'.$fbid.'/albums','GET');
$albums = $albums_resp['data'];
//prepare batch query for album covers
$queries = array ();
foreach ($albums as $album)
{
if ($album['cover_photo'] != null)
{
$query = array('method' => 'GET', 'relative_url' => $album['cover_photo']);
array_push($queries, $query);
}
}
$queries_str = json_encode($queries);
$batchResponse = $facebook->api('?batch='.$queries_str, 'POST');
I know that there is another way by using the URL /{albumID}/picture?type=small
as indicated here but I still can't get the same image sizes facebook shows in covers (I tried thumbnail
, small
, cover
), and when I use this approach in a batch request for all albums I don't seem to have any way to correlate the response with the album ID. What I get in response is a redirect status 302 with the location of the image.
I don't want to put the image links directly /{albumID}/picture?type=small
either because if there are 25 albums it means 25 image redirects, making the page slow.