ServerSideSkittles
ServerSideSkittles

Reputation: 2973

Facebook Graph Api: How do I retrieve a large image from a groups feed?

When querying a feed from a groups ID I can retrieve information from fields like picture and full_picture. After parsing the data using json and PHP the output of the full_picture image is too small.

Here is the data im retrieving

This is what I use to show the data for the full_picture and picture

if (isset($data->full_picture)) echo "<img src=\"$data->full_picture?\" /><br><br>";
if (isset($data->picture)) echo "<img src=\"$data->picture\" /><br><br>";

Here is the output

https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBVMHFsrd2L-8RU&url=https%3A%2F%2Ffbcdn-photos-e-a.akamaihd.net%2Fhphotos-ak-ash3%2F935434_10151639263649134_680895879_s.jpg
https://fbcdn-photos-e-a.akamaihd.net/hphotos-ak-ash3/935434_10151639263649134_680895879_s.jpg

However I have noticed if I can the end url in the browser manually from _s.jpg to _n.jpg, it displays the full size.

There must be a way to output the full size from the graph? I have tried using the Facebook documentation and all I can find is this which does not work for what I am trying to do :/

Upvotes: 0

Views: 1712

Answers (1)

user2488871
user2488871

Reputation: 21

Use str_replace function right before you output the image.

$data->full_picture = str_replace("_s.jpg","_n.jpg",$data->full_picture);

Upvotes: 2

Related Questions