franvergara66
franvergara66

Reputation: 10784

PHP: Assign avatar of the webmail server used

I'm doing a website for registration, in which I want to assign the webmail server avatar image used by the user (gmail, hotmail, etc). For example using gravatar realize managed as follows:

<img src="http://www.gravatar.com/avatar/<?php print md5(strtolower(trim('email')))?>?d=imagendefault.jpg&s=150" />

I know that for gmail emails, I can use The Google Contacts API for Contact photo management toretrieve a contact's photo, send an authorized GET request to the contact's photo link URL. The URL is of the form:

https://www.google.com/m8/feeds/photos/media/{userEmail}/{contactId}

But I'm not sure what is the parameter 'contactid'. My question is .. there is some method to get the profile picture of live / msn / outlook / hotmail and gmail? and how I can know that it's contactid to do with Gmail. Or if there is any easier method where you do not have to copy the image directly to my server. Thanks a lot.

Upvotes: 1

Views: 619

Answers (1)

tyler
tyler

Reputation: 1293

<img src="https://plus.google.com/s2/photos/profile/116018066779980863044?sz=100" width="100" height="100"> No need to store the image on your server.

Now if you dont know how to get the user id a simple solution is use https://plus.google.com/s2/photos/profile/me for the pic link ... and here you will need to pull the pic to your server...This will require the user previously being logged into google.

And to get the id you might find this of some help https://developers.google.com/+/api/latest/people/get

Upvotes: 1

Related Questions