Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
           });
      }
    }
  });
like image 238
elauria Avatar asked Jan 26 '12 18:01

elauria


People also ask

Why is my Facebook profile picture low resolution?

Pixels: The profile picture on Facebook has a pixel limitation that you might not be aware of. If your picture exceeds the pixel restriction, the picture is automatically adjusted and the quality will be reduced. Right format: The right image format is important to avoid the blurry end result.


3 Answers

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.

like image 199
DMCS Avatar answered Sep 28 '22 08:09

DMCS


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

like image 34
Mantas Avatar answered Sep 28 '22 06:09

Mantas


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

like image 41
seantomburke Avatar answered Sep 28 '22 08:09

seantomburke