Getting Google+ profile picture url with user_id
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?
UPDATE: The method below DOES NOT WORK since 2015
It is possible to get the profile picture, and you can even set the size of it:
https://plus.google.com/s2/photos/profile/<user_id>?sz=<your_desired_size>
Example: My profile picture, with size set to 100 pixels:
https://plus.google.com/s2/photos/profile/116018066779980863044?sz=100
Usage with an image tag:
<img src="https://plus.google.com/s2/photos/profile/116018066779980863044?sz=100" width="100" height="100">
Hope you get it working!
UPDATE: Google stopped support for this method, that now returns a 404 (not found) error.
All this urls fetch the profile picture of a user:
https://www.google.com/s2/photos/profile/{user_id}
https://plus.google.com/s2/photos/profile/{user_id}
https://profiles.google.com/s2/photos/profile/{user_id}
They redirect to the same image url you get from Google API, an ugly link as
lh6.googleusercontent.com/-x1W2-XNKA-A/AAAAAAAAAAI/AAAAAAAAAAA/ooSNulbLz8U/photo.jpg
The simplest is to directly use like image source:
<img src="https://www.google.com/s2/photos/profile/{user_id}">
Otherwise to obtain exactly the same url of a Google API call you can read image headers,
for example in PHP:
$headers = get_headers("https://www.google.com/s2/photos/profile/{user_id}", 1);
echo "<img src=$headers[Location]>";
as described in article Fetch Google Plus Profile Picture using PHP.