0

With this code i can have the original size of the image:

var img = new Image();
img.onload = function() {
  alert(this.width + 'x' + this.height);
}
img.src = 'something.jpg';

and what if i have all images loaded on DOM already, how can i get the same info!?

Thanks ;-)

Rpgccv
  • 137
  • 2
  • 14
  • Why can't you just use `img.width + 'x' + img.height`, in case the image is loaded already. – rrk Mar 13 '16 at 11:39
  • 1
    Possible clone of http://stackoverflow.com/questions/623172/how-to-get-image-size-height-width-using-javascript ? – nelfurion Mar 13 '16 at 11:39
  • You could use jQuery `each` function - https://jsfiddle.net/azizn/LavhLt50/ – Aziz Mar 13 '16 at 11:46

0 Answers0