获取图片宽、高
程序员文章站
2022-06-21 14:49:35
...
var image = new Image();
var that = this;
image.onload = function(){
if ("naturalWidth" in image) { // 现代浏览器
that.width = image.naturalWidth;
that.height = image.naturalHeight;
} else { // IE6/7/8
that.width = image.width;
that.height = image.height;
}
image = undefined;
delete image;
}
转载于:https://my.oschina.net/u/232595/blog/469156
上一篇: Echarts 随页面大小变化自适应
下一篇: 【工具代码】目标检测绘制评估曲线