JSFiddle - React, Tailwind, and code Playground

HTML

<input type="file">

JavaScript

$('input').change(function() {
    
    var u = URL.createObjectURL(this.files[0]);
    var img = new Image;
      
    img.onload = function() {
        alert(img.width);
    };
        
    img.src = u;
    
});