tofacebook.com -专业IT技术社区(指牛堂) 在js中获取上传图片的宽度和高度 Web程序 - 指牛堂-专业IT技术平台
141°

在js中获取上传图片的宽度和高度 Web程序

标签:res   htm   das   nbsp   width   apu   load   map   col   

Html:

1 <input type="file" id="MapUploadTd" onchange="getMapPictureSize(this.files[0])"/>

Js:

 1 var mapPictureSize = [];
 2 
 3 function getMapPictureSize(file) {
 4     var reader = new FileReader;
 5     reader.onload = function (evt) {
 6         var image = new Image();
 7         image.onload = function () {
 8             mapPictureSize[0] = this.width + "";
 9             mapPictureSize[1] = this.height + "";
10             console.log(mapPictureSize);
11         };
12         image.src = evt.target.result;
13     };
14     reader.readAsDataURL(file);
15 }

 

在js中获取上传图片的宽度和高度

标签:res   htm   das   nbsp   width   apu   load   map   col   

原文地址:https://www.cnblogs.com/NickyLi/p/8571490.html


本文由百家号/熊掌号作者上传并发布,百家号仅提供信息发布平台。文章仅代表作者个人观点,不代表百度立场。

已有 0 条评论

    我有话说: