jquery获取上传图片的尺寸


var _URL = window.URL || window.webkitURL;
$("#aieg_b_img").on("change",function(){
     var files=$(this).prop('files');
     var file, img;
     if ((file=files[0])) {
       img = new Image();
       img.onload = function () {
           $('#bigimg-size').text('图片尺寸为:'+this.width+"*"+this.height);
       };
       img.src = _URL.createObjectURL(file);
     }
});

猜你喜欢

转载自blog.csdn.net/mr_yarnell/article/details/76615451