Home » Php » php – getting facebook thumbnail profile picture

php – getting facebook thumbnail profile picture

Posted by: admin July 12, 2020 Leave a comment


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

I know to get the full size picture I can do the folllowing:

//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 on how to get the thumbnail/avatar size. Something like a 50×50 size

How to&Answers:

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

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


As of August 2012, you can define custom dimensions for the user thumbnail, e.g. https://graph.facebook.com/USER_ID/picture?width=WIDTH&height=HEIGHT. Find out more, https://developers.facebook.com/docs/reference/api/using-pictures/.


I did the following to accomplish the same thing:

       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


Since you have the UID of the person, you can easily get the 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.. cheers… sizes can be small, normal, album, large, square