Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving a user's public google/gmail picture

I'm writing an email-based application using the gmail-api, and i need to retrieve user public images for email address originating from google. I've seen other applications do that, but i can't seem a way to reliably get this data.

some more information:

  • i'm using oauth2 to sign the user in - and i have no problem requesting any type of permissions there.
  • i've tried retrieving the image using the google+ api - but it requires a userID for that - and i don't know how to get the userId for the email address (gmail-api doesn't give it, afaik).
  • i've tried using the contacts API - but it only gives images for the user's contacts, while the email clients can display images from other users as well.

Thanks!

Edit:

I know i can receive the required images from google plus, if i have the other user's userid. however, i can't find a way to get the userid based on an email address.

like image 955
shaish Avatar asked Sep 01 '14 12:09

shaish


People also ask

How can I see someone's Gmail profile picture?

Hover over their avatar, then click their name when it pops up in blue. Now you're at their Google+ profile. (You can also get there by clicking their profile pic in Google Hangouts.) Hover on the avatar in your own sent emails, and you can see your own profile.

Can you find a person with Google Images?

Tap on Search with Google Lens. Select how you want to search: Use an object in the image: If available, on the object, tap on Select. Use part of an image: Tap on the Select image area, then drag the corners of the box around your selection.

Are Google profile pictures public?

Your name and profile picture can be viewed by other people who use Google services where your main Google Account profile is shown, including when you communicate or share content. Tip: For other info that you add, you can choose if it's private or visible to anyone.

Can other people see my Gmail photo?

Visible to everyone means anyone who you email, or who emails you, can see your picture. If you have a public Google profile without a photo and you choose this option, your picture will be used on your Google profile and will be visible to others there.


2 Answers

Is very easy

http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json

just has a little problem.

You only can get the picture of your Google+ profile, not directly from your gmail.

UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

More Info Here

like image 163
jose920405 Avatar answered Sep 24 '22 03:09

jose920405


UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

Info Here

Based on @jose920405 answer, I have written this free public API service called Pikmail API. Here some advantages.

  • No authentication needed.
  • It's totally free and open source.
  • It's written in Kotlin.
  • You don't need to write some wrapper for mapping the response.

Here is the blog post about how Pikmail API works internally.

Usage:

Html

<img src="https://pikmail.herokuapp.com/[email protected]?size=50" alt="Profile Picture"> 

Profile Picture

Java Android

Picasso.with(context).load("https://pikmail.herokuapp.com/[email protected]?size=50").into(imageView); 

Feel free to contribute with you pull requests, open bugs or request new features here.

Note: This service is based on an independent library called Pikmail that can be used as a Gradle dependency in your java projects(servers or Android apps).

like image 32
epool Avatar answered Sep 22 '22 03:09

epool