mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-11 06:07:24 +08:00
图片压缩时 不能大于1080
This commit is contained in:
parent
75362a6342
commit
277e96f0f7
@ -21,8 +21,20 @@ export function translate(imgSrc, callback) {
|
|||||||
var h = that.height;
|
var h = that.height;
|
||||||
|
|
||||||
// 默认按比例压缩
|
// 默认按比例压缩
|
||||||
|
|
||||||
var w = that.width;
|
var w = that.width;
|
||||||
|
|
||||||
|
if(h > 1080 || w > 1080){
|
||||||
|
let _rate = 0;
|
||||||
|
if(h > w){
|
||||||
|
_rate = h/1080;
|
||||||
|
h = 1080;
|
||||||
|
w = Math.floor(w/_rate);
|
||||||
|
}else{
|
||||||
|
_rate = w/1080;
|
||||||
|
w = 1080;
|
||||||
|
h = Math.floor(h/_rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user