Loading…

How to get image width height in angular js, before uploading a file?

getCheckDimenstions(ev: Event) {
   if (ev && ev.target && ev.target.files) {
     const file = ev.target.files[0];
     const img = new Image();
     img.onload = function() {
       alert('Width:' + this.width + ' Height: ' + this.height);
     };
     img.src = URL.createObjectURL(file);
  }
}

Suggest An Answer

No suggestions avaliable!

Latest post from Angularjs Interview Questions

Ask Question