i am using this code to implement login with google in my website.
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}
</script>
but i am getting small profile pic in console. how can i get url for largest profile pic from google?
You have a contact saved with your email address and the photo is saved there. Locate the contact and delete the photo and it will take the one from your Google profile automatically. Show activity on this post.
Turns out if you right-click a profile picture and "Open Image In New Tab" and then look at it's URL, there will be a "s=48". You can change that number to whatever size you want and it will give you a version of the picture in that size. Sorry if this is no longer relevant.
What size image should I use for my Google profile picture? Google recommends that your picture size be 250 pixels by 250 pixels. However, if you choose something larger, Google will scale it down.
After you have signed in a user with Google using the default scopes, you can access the user's Google ID, name, profile URL, and email address.
Add the query parameters to the imageurl ?sz=x, where x is your image size.
Basically answered here
Retrieving profile image from Google+ API
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