elauria
elauria

Reputation: 117

Get Facebook Profile Picture in higher resolution

I was looking for the best way to get a user profile picture with the Facebook Graph API.

Looking through the documentation, I've found this:

You can specify the picture size you want with the type argument, which should be one of square (50x50), small (50 pixels wide, variable height), normal (100 pixels wide, variable height), and large (about 200 pixels wide, variable height)

My question is: Is there any way to get the profile picture on a higher resolution than 200px?

I've recently found this solution, but I don't know how can I check if the user has the album in another language:

FB.api('/me/albums', function (response)
  {
    for (album in response.data)
    {
      // Find the Profile Picture album
      if (response.data[album].name == "Profile Pictures")
      {
         // Get a list of all photos in that album.
         FB.api(response.data[album].id + "/photos", function(response)
           {
             // The image link
             image = response.data[0].images[0].source;
           });
      }
    }
  });

Upvotes: 9

Views: 17302

Answers (4)

seantomburke
seantomburke

Reputation: 11702

You can get the full quality image by using the Facebook JavaScript API:

FB.api('/{ID}?fields=picture.height(2048)', function(response){
   $("#profile_pic").attr("src",response.picture.data.url);
});

Assuming you have a

<img id="profile_pic" src=""/> 

Somewhere in the body

Upvotes: 4

DMCS
DMCS

Reputation: 31870

This is straight from the documentation

You can specify the picture size you want with the type argument, which should be one of square (50x50), small (50 pixels wide, variable height), normal (100 pixels wide, variable height), and large (about 200 pixels wide, variable height):

http://graph.facebook.com/{ID}/picture?type=large

Now, there's nothing stopping you from calling into the graph to get larger sizes, but you have to have a valid user access token to do so.

Upvotes: 12

jofftiquez
jofftiquez

Reputation: 7708

Am doing.

FB.api('/'+id+'/picture?type=large&width=300&height=300', function(response){
    if(response && !response.error){
        // do your stuff.
    }
})

You can define the width and height to any value that suits you. You will see the additional options on their documentation.

Upvotes: 0

Mantas
Mantas

Reputation: 4296

You can control it by query string parameters by adding width and height: https://graph.facebook.com/1483610454/picture?width=160&height=160 https://graph.facebook.com/1483610454/picture?width=300&height=300

Upvotes: 6

Related Questions