image height and width

image height

by Nibin George

HTML

<span id="preview"></span>

<input type="file" id="file" />

JavaScript

function getfilesize(files) {
    var reader = new FileReader();
    var img = new Image();
    reader.onload = function (e) {
        img.src = e.target.result;
        img.onload = function () {
            alert("width=" + this.width + " height=" + this.height);
        };
};
    reader.readAsDataURL(files);
}


$("#file").change(function () {
    var file = this.files[0];
    getfilesize(file);
});