Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether Google User's image is default or uploaded?

How do I check whether user's profile picture is default or uploaded in Google?

Note: When you get user details from APIs.

Google User's Default Image

like image 679
Love Sharma Avatar asked Dec 25 '14 18:12

Love Sharma


People also ask

What is Google Images and how does it work?

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.

Why can't I see images in Gmail?

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.

How do I do a Google Image Search?

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.

How do I change the default image settings in Gmail?

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.


2 Answers

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
    }
  ]
}
like image 99
incaren Avatar answered Oct 22 '22 07:10

incaren


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
}
like image 30
abraham Avatar answered Oct 22 '22 07:10

abraham