JSFiddle - React, Tailwind, and code Playground

by CJ Juarez

HTML

<input type="file" id="file" />
<p class="size"></p>

JavaScript

var _URL = window.URL || window.webkitURL;

$("#file").change(function(e) {
    
    var image, file;

    if ((file = this.files[0])) {
       
        image = new Image();
    
        image.onload = function() {
            $(".size").text(this.width + "x" + this.height);
        };
        image.src = _URL.createObjectURL(file);
    }
});