Retrieving facebook thumbnail profile image

Does anyone know how I can get facebook user thumbnail / avatar using javascript sdk?

I know to get a full size image, which I can do as follows:

//Get a list of all the albums 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; }); } } }); 

Not sure how to get thumbnail / avatar size. Something like 50x50 size

+7
source share
4 answers

You can also use the <img> with a special URL to do the same:

 <img src="http://graph.facebook.com/<UID>/picture?type=square" /> 
+26
source

As of August 2012, you can define custom sizes for a user's thumbnail, for example. https://graph.facebook.com/USER_ID/picture?width=WIDTH&height=HEIGHT . Learn more at https://developers.facebook.com/docs/reference/api/using-pictures/ .

+3
source

I did the following to accomplish the same thing:

  FB.api (
       {
        method: 'fql.query',
        query: 'SELECT name, email, pic_small FROM user WHERE uid =' + uid
        // uid is the id of the user.
       },
       function (response) {
          var user = response [0];
          // user.pic_small contains the url for the small sized profile pic
       });
+1
source

Since you have a person’s UID, you can easily get an image. For example, my profile image URL should be graph.facebook.com/v2.8/1375341351/picture?type=small (now change the type parameter and enjoy different sizes .. hooray ... sizes can be small, normal, albums big square

0
source

All Articles