- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在向我的网站添加谷歌登录,但找不到任何文档来解释如何指定 getBasicProfile() 代码中 getImageUrl() 返回的图像的大小。这是我正在使用的代码:
function startApp() {
gapi.load('auth2', function(){
auth2 = gapi.auth2.init({
client_id: 'apps.googleusercontent.com',
cookiepolicy: 'single_host_origin',
});
attachSignin(document.getElementById('gLogin'));
});
};
startApp();
function attachSignin(element) {
auth2.attachClickHandler(element, {}, function(googleUser) {
var profile = googleUser.getBasicProfile();
$.ajax({
type:'POST',
url: '/example.com',
data: {
ID: profile.getId(),
firstName: profile.getGivenName(),
lastName: profile.getFamilyName(),
profileImage: profile.getImageUrl(),
emailAddress: profile.getEmail(),
tokenID: googleUser.getAuthResponse().id_token,
formID: 'gLogin'
},
success:function(data) {
if (data == 'success') {
window.location.reload(false);
}else{
alert(data);
}
},
error: function() {
alert('There was an error in our system! Please try again later.');
}
}) // End of Ajax Code
}, function(error) {
alert(JSON.stringify(error, undefined, 2));
});
}
本质上,这段代码非常适合我的情况,但 profile.getImageUrl() 返回的图像返回 50px 图像。如何指定需要返回的尺码?有办法吗?
谢谢!
最佳答案
在 Google 为您提供的网址中,将“s96-c”替换为“sX-c”,其中 X 是您想要的图像尺寸。我有点惊讶这对我来说很难找到。一定花了一两个小时四处寻找答案。最终在这里找到它:https://stackoverflow.com/a/55630187/2576959
关于javascript - Google Signin getImageUrl() 图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43856467/
小尺寸创建的图像太大而无法放入框中。有没有一种方法可以将图像完全包裹起来? 我在做 其中 arguments.width = 163px; arguments.height=163px
我正在向我的网站添加谷歌登录,但找不到任何文档来解释如何指定 getBasicProfile() 代码中 getImageUrl() 返回的图像的大小。这是我正在使用的代码: function sta
我在整个页面中使用这个 $categories $categories = Mage::getModel('catalog/category') ->getCollection() -
本文整理了Java中org.scribe.up.profile.yahoo.YahooImage.getImageUrl()方法的一些代码示例,展示了YahooImage.getImageUrl()的
这个问题已经有答案了: What is a NullPointerException, and how do I fix it? (12 个回答) 已关闭 4 年前。 我想在 Android Stud
我是一名优秀的程序员,十分优秀!