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 :)

Richard
  • 14,427
  • 9
  • 57
  • 85

7 Answers7

127

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.

Lri
  • 26,768
  • 8
  • 84
  • 82
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.

grg
  • 5,023
  • 3
  • 34
  • 50
Smita
  • 4,634
  • 2
  • 25
  • 32
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;
    }
}
sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Richard
  • 14,427
  • 9
  • 57
  • 85
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.

2

For Angular:

getUserPicture(userId) {   
FB.api('/' + userId, {fields: 'picture.width(800).height(800)'}, function(response) {
  console.log('getUserPicture',response);
});
}
scott_lotus
  • 3,171
  • 22
  • 51
  • 69
Vương Hữu Thiện
  • 1,460
  • 14
  • 21
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); 
              });                  
            }
          }   
        });
    }
  });
}
sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Kristian
  • 21
  • 4
-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?

ACarter
  • 5,688
  • 9
  • 39
  • 56
  • 5
    are they really? if you click on a profile, you get to the full pic :) – Richard Dec 20 '11 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 Dec 20 '11 at 13:50
  • But my app requested user_picture permissions? – Richard Dec 20 '11 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 Dec 20 '11 at 17:46