判断图片是否存在 以及获取图片大小
获取图片大小
function imgLoad(imgSrc){
return new Promise(function (resolve, reject) {
var ImgObj = new Image();
ImgObj.src = imgSrc;
if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
resolve({width:ImgObj.width,height:ImgObj.height})
}
ImgObj.onload=function(){
resolve({width:this.width,height:this.height})
}
ImgObj.src = imgSrc;
})
}