Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Google+ profile picture url with user_id

I know that lots of social network APIs provide a way to construct a url to the profile picture of a user, using their user_id or username. For Facebook it looks like this:

http://graph.facebook.com/user_id/picture?type=square

Now is there something like this for Google Plus? Or any other way to get user's pic without an API call??

like image 292
ArVan Avatar asked Feb 03 '12 12:02

ArVan


1 Answers

Google had changed their policy so the old way for getting the Google profile image will not work now, which was

https://plus.google.com/s2/photos/profile/(user_id)?sz=150

New Way for doing this is

Request URL

https://www.googleapis.com/plus/v1/people/115950284...320?fields=image&key={YOUR_API_KEY} 

That will give the Google profile image url in json format as given below

Response :

{     "image":      {          "url": "https://lh3.googleusercontent.com/-OkM...AANA/ltpH4BFZ2as/photo.jpg?sz=50"     } } 

More parameters can be found to send with URL which you may need from here

For more detail you can also check the given question where I have answered for same type of problem How to get user image through user id in Google plus?

like image 158
Deepak Goswami Avatar answered Oct 05 '22 02:10

Deepak Goswami