Get Facebook Image Higher Resolution Image

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

Looking through the documentation, I found this:

You can specify the size of the image you want, with an argument of the type that should be one of the squares (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 a way to get a profile image with a higher resolution than 200 pixels?

I recently found this solution, but I don’t know how to check if the user has an 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; }); } } }); 
+6
source share
4 answers

This is straight from the documentation.

You can specify the desired image size with an argument of the type, which should be square (50x50), small (width 50 pixels, 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 is nothing that would prevent you from calling the graph to get large sizes, but for this you must have a valid user access token.

+7
source
+5
source

You can get a full quality image 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

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

Somewhere in the body

+4
source

I do it.

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

You can define width and height any value that suits you. You will see additional options in your documentation.

0
source

Source: https://habr.com/ru/post/906964/


All Articles