Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login with google get large profile picture [duplicate]

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?

like image 966
Gaurav Srivastava Avatar asked Nov 05 '15 05:11

Gaurav Srivastava


People also ask

Why does my Google Account have two profile pictures?

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.

How do I get my full profile picture on Google?

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.

How big is a Google Account profile picture?

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.

What data can I get from Google login?

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.


1 Answers

Add the query parameters to the imageurl ?sz=x, where x is your image size.

Basically answered here

Retrieving profile image from Google+ API

like image 52
Olavi Sau Avatar answered Nov 10 '22 00:11

Olavi Sau