直播网站程序源码,获取本地上传图片的尺寸(宽高)
<input id="file" @change="uploadImegs($event,3)" type="file" accept="image/*" />
uploadImegs(e) {
let _file = e.target.files[0];
if (_file) {
if (!/\.(jpg|jpeg|png|JPG|PNG)$/.test(e.target.value)) {
this.$Message.info("图片类型必须是,jpeg,jpg,png中的一种");
return false;
}
let reader = new FileReader();
reader.onload = e => {
var image = new Image();
image.src = e.target.result;
image.onload = function() {
let width = 0
let height = 0
console.log("宽" + this.width, "高" + this.height)
};
let data;
data = e.target.result;
this.cropperData.imgUrl = data;
};
reader.readAsDataURL(_file);
}
e.target.value = ""
}
以上就是直播网站程序源码,获取本地上传图片的尺寸(宽高), 更多内容欢迎关注之后的文章
标签:target,宽高,直播,let,上传,源码 From: https://www.cnblogs.com/yunbaomengnan/p/16835918.html