Get profile picture from facebook, google, twitter and gravatar

An useful resource for developer that requires profile images from various social network website. In this article you will learn how to get profile picture URL from Facebook, Google, Twitter and Gravatar.

Get profile picture from facebook

Use following url to get facebook profile image. You have to replace <ID> with user id or uname of facebook user

http://graph.facebook.com/<ID>/picture?type=<small|normal|album|large|square>

Get Google+ profile picture URL

This method require google API key. To get google API key visit https://code.google.com/apis/console

After getting API key call following URL with user id and your API key

https://www.googleapis.com/plus/v1/people/<USER-ID>?fields=image&key=<YOUR_API_KEY>

In response you will get JSON object with profile picture URL

{
 "image": {
  "url": "https://lh5.googleusercontent.com/-wfeGlIdKTZU/AAAAAAAAAAI/AAAAAAAAAMw/oHcmigW8rwg/photo.jpg?sz=50",
  "isDefault": false
 }
}

Get profile picture from twitter

Call following URL with your twitter screen_name

https://twitter.com/<screen_name>/profile_image?size=<mini|normal|bigger|original>

Reference Twitter Developers Documentation

Get profile picture from gravatar

To get profile picture from gravatar first calculate md5 hash of user’s email ID then call following URL with that hash

http://www.gravatar.com/avatar/<md5 hash of email>?s=<size in pixels>

For example

http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200

 


Liked It? Get Free updates in your Email

Delivered by feedburner

5 thoughts on “Get profile picture from facebook, google, twitter and gravatar

  1. Rajkumar Soy
    #

    How to get Large profile image with google+

    Reply
  2. Vss
    #

    How to get linkedin profile picture

    Reply
    1. sanjay
      #

      function getProfileData() {
      IN.API.Raw(“/people/~:(id,email-address,first-name,last-name,formatted-name,picture-url)?format=json”).result(onSuccess).error(onError);
      }

      Reply
  3. alejandro
    #

    Could you please update the twitter one, since the new API this doesn’t work anymore, cheers

    Reply
  4. Devang Srivastava
    #

    Hello, I created a completely free API that can do this for you, Dev Identify. Some of it’s sources is Google, G+ and Gravatar. It provides name, location and profile picture data.
    https://devidentify.com

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *