Thứ Năm, 14 tháng 12, 2017

lấy chiều cao + chiều ngang của ảnh trong script

var _URL = window.URL || window.webkitURL;
var file = files[0];
var height_new = 1200;

img = new Image();
img.src = _URL.createObjectURL(file);
img.onload = function() {
    imgwidth = this.width;
    imgheight = this.height;

    if(imgheight >= height_new){
        console.log("ok");
        return true;
    }else{
        alert("Chiều cao phải lớn hơn 1200");
        // s.cancelAll();
        reset(false);
    }
}

Không có nhận xét nào:

Đăng nhận xét