I would like to know how to calculate the size (width and height) of several images using jquery, I would like to validate those sizes. This is the script that I have up to.
/*jQuery*/
var ancho;
var alto;
$("img").each(function(){
ancho = $(this).width();
alto = $(this).height();
if(ancho < alto)
console.log("Es más ancha");
else if(ancho > alto)
console.log("Es más alto");
else
console.log("Es una imagen cuadrada");
});
This is the HTML code
<!--HTML-->
<img src="imagen1.jpg">
<img src="imagen2.jpg">
<img src="imagen3.jpg">