最近写了小程序。但是发现一个问题就是微信授权后得到的图片非常的不清晰;
原图是这样:

授权后得到的图片:

/**
* @param {转换代码的过程} imageUrl
*/
headimgHD: function(imageUrl) {
imageUrl = imageUrl.split('/'); //把头像的路径切成数组
//把大小数值为 46 || 64 || 96 || 132 的转换为0
if (
imageUrl[imageUrl.length - 1] &&
(imageUrl[imageUrl.length - 1] == 46 ||
imageUrl[imageUrl.length - 1] == 64 ||
imageUrl[imageUrl.length - 1] == 96 ||
imageUrl[imageUrl.length - 1] == 132)
) {
imageUrl[imageUrl.length - 1] = 0;
}
imageUrl = imageUrl.join('/'); //重新拼接为字符串
return imageUrl;
},
贴一下自己做的小程序路过的可以帮忙扫一下;提提BUG和意见等谢谢~

网友评论