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<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

After getting API key call following URL with user id and your API key<USER-ID>?fields=image&key=<YOUR_API_KEY>

In response you will get JSON object with profile picture URL

 "image": {
  "url": "",
  "isDefault": false

Get profile picture from twitter

Call following URL with your twitter screen_name<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<md5 hash of email>?s=<size in pixels>

For example


Published by Sunny

A Mechanical engineer by education and web developer by passion and profession. He lives in Lucknow, India. Currently earning his livings by hitting keyboad. ;)

Join the Conversation


    1. function getProfileData() {

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

Leave a comment

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