How do I check whether user's profile picture is default or uploaded in Google?
Note: When you get user details from APIs.
Google Images is a way to visually discover information on the web. Users can quickly explore information with more context around images with new features, such as image captions, prominent badges, and AMP results.
If images don't load in Gmail, check your settings. On your computer, go to Gmail. In the top right, click Settings See all settings. Scroll down to the "Images" section. Click Always display external images. At the bottom of the page, click Save Changes. Note: If Gmail thinks a sender or message is suspicious, you won’t see images automatically.
A Google image search can be done in one of two ways: either by dragging the photo to a tab or window in your browser open on the Google image search page, or by using a Chrome extension. Go to images.google.com/ and click the image button.
On your computer, go to Gmail. In the top right, click Settings See all settings. Scroll down to the "Images" section. Click Always display external images. At the bottom of the page, click Save Changes. Note: If Gmail thinks a sender or message is suspicious, you won’t see images automatically.
Updating this answer for 2020: it's now possible to get the user's profile picture by sending a request to the people.get
API with photos
as the personFields
to request.
You'll get back an array of images, and whenever default: true
is present, it means it's a default (not user-set) image:
Example (if you're using this with OAuth):
GET https://people.googleapis.com/v1/people/me
Sample response (with profile picture)
{
"resourceName": "people/117055959617985617271",
"etag": "%EgQBAzcuGgQBAgUHIgxHamp6MG9wZ3hOcz0=",
"photos": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "117055959617985617271"
}
},
"url": "https://lh3.googleusercontent.com/a-/AOh14Gg_-udXd3O6K1URTBTEK2rLa2DOh6G2dgmOHcOBOtE=s100"
},
{
"metadata": {
"source": {
"type": "CONTACT",
"id": "2"
}
},
"url": "https://lh3.googleusercontent.com/a/default-user=s100",
"default": true
}
]
}
Sample response (default only)
{
"resourceName": "people/113009277022343767972",
"etag": "%EgQBAzcuGgQBAgUHIgxxdHVTY3IxZVJIUT0=",
"photos": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "113009277022343767972"
}
},
"url": "https://lh6.googleusercontent.com/-6NS3awoYRXw/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnTo-mElIpcAEazDV9DAs1VyYDEIw/s100/photo.jpg",
"default": true
}
]
}
people.get includes a isDefault
value in the image object. E.g. if you try it for +Google
you will get;
"image": {
"url": "https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAACyas/yR1_yhwBcBA/photo.jpg?sz=50",
"isDefault": false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With