53

Is there anyway to get the full-size profile picture using any facebook api?

http://graph.facebook.com/{ID}/picture?type=large is way to small.

Thanks :)

7 Answers 7

126

Set either the width or height to some arbitrarily large number:

https://graph.facebook.com/username_or_id/picture?width=9999

If the width and height are the same number, the photo is cropped to a square.

4
  • Don't think there's anything magic about this number. Could probably be any big number...
    – Michael
    Commented Mar 10, 2014 at 21:45
  • This still gives the smaller picture.
    – Foreever
    Commented Aug 19, 2014 at 6:45
  • 3
    This is awesome. Why facebook has no clear docs on this annoys me.
    – user240993
    Commented Jul 7, 2015 at 20:45
  • It looks like it is not working anymore, I get an error (GraphMethodException).
    – baptx
    Commented Jul 28, 2022 at 20:26
87

I think I use the simplest method to get the full profile picture. You can get full profile picture or you can set the profile picture dimension yourself:

$facebook->api(me?fields=picture.width(800).height(800))

You can set width and height as per your need. Though Facebook doesn't return the exact size asked for, It returns the closest dimension picture available with them.

0
6

found a way:

$albums = $facebook->api('/' . $user_id . '/albums');
foreach($albums['data'] as $album){
    if ($album['name'] == "Profile Pictures"){
        $photos = $facebook->api('/' . $album['id'] . '/photos');
        $profile_pic = $photos['data'][0]['source'];
        break;
    }
}
0
4

As noted above, it appears that the cover photo of the profile album is a hi-res profile picture. I would check for the album type of "profile" rather than the name though, as the name may not be consistent across different languages, but the type should be.

To reduce the number of requests / parsing, you can use this fql: "select cover_object_id from album where type='profile' and owner = user_id"

And then you can construct the image url with: "https://graph.facebook.com/" + cover_object_id + "/picture&type=normal&access_token=" + access_token

Looks like there is no "large" type for this image, but the "normal" one is still quite large.

As noted above, this photo may be less accessible than the public profile picture. You need the user_photos or friend_photos permission to access it.

0
2

With Javascript you can get full size profile images like this

pass your accessToken to the getface() function from your FB.init call

function getface(accessToken){
  FB.api('/me/friends', function (response) {
    for (id in response.data) { 
        var homie=response.data[id].id         
        FB.api(homie+'/albums?access_token='+accessToken, function (aresponse) {
          for (album in aresponse.data) {
            if (aresponse.data[album].name == "Profile Pictures") {                      
              FB.api(aresponse.data[album].id + "/photos", function(aresponse) {
                console.log(aresponse.data[0].images[0].source); 
              });                  
            }
          }   
        });
    }
  });
}
2

For Angular:

getUserPicture(userId) {   
FB.api('/' + userId, {fields: 'picture.width(800).height(800)'}, function(response) {
  console.log('getUserPicture',response);
});
}
-7

Profile pictures are scaled down to 125x125 on the facebook sever when they're uploaded, so as far as I know you can't get pictures bigger than that. How big is the picture you're getting?

4
  • 5
    are they really? if you click on a profile, you get to the full pic :)
    – Richard
    Commented Dec 20, 2011 at 13:03
  • Yes, but that picture is not classified as the profile picture. Facebook stores the profile picture (the 125x125 thumbnail), aswell as the original picture. I think you can only access the profile picture, because other pictures of a person are more personal.
    – ACarter
    Commented Dec 20, 2011 at 13:50
  • But my app requested user_picture permissions?
    – Richard
    Commented Dec 20, 2011 at 17:39
  • Oh, well then I can only think that the URL you gave above is not the right way to access the picture.
    – ACarter
    Commented Dec 20, 2011 at 17:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.