is there a way to find the the profile image of a user that's logged in using his/her google account (through OpenID).
I've checked stackoverflow and it seems they're using gravatar service to assign an avatar to the email address. but it should be possible to fetch the user google profile image directly from google.
any clue?
It is not possible with OpenId alone. You have two solutions:
You don't use the Google picture image, but a picture provided by a third party like Gravatar (it's the simplest way and it's what is used by Stackoverflow);
You use the Google Apps Profiles API: see there to retrieve the photo. In that case, the user must be authenticated, for example with the Oauth Protocol: see Google documentation there. If you choose this solution, I suppose you will continue to use OpenId, so you will use both OpenId and Oauth. Google supports an hybrid protocol to simplify this process: the hybrid protocol OpenId+OAuth.
Hope it helps...
UPDATED: currently, that approach not working
I am currently use that approach:
I am also noticed that if after showing avatar I login with another google account, avatar image is still old. To avoid this, I am adding "&cache_fix=" to image url.
$(".social_avatar")
.load(function() { $(".social_avatar").css('visibility', 'visible'); })
.error(function() { $(".social_avatar").attr('src', "/dummy_google_icon.png"); })
.css('visibility', 'hidden')
.attr("src", "http://profiles.google.com/s2/photos/profile/me?sz=32&cache_fix=<userid>");
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