How to get the image size (height & width) using JavaScript

You can programmatically get the image and check the dimensions using JavaScript…

const img = new Image();
img.onload = function() {
  alert(this.width + 'x' + this.height);
}
img.src="http://www.google.com/intl/en_ALL/images/logo.gif";

This can be useful if the image is not a part of the markup.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)