I am creating an image gallery with jquery. Is there any possibilities to Calculate whether an image is landscape or portrait using jquery?
Thanks for your support.
This worked for me, using the natural height/width to get the original properties.
function imageOrientation(src) {
var orientation,
img = new Image();
img.src = src;
if (img.naturalWidth > img.naturalHeight) {
orientation = 'landscape';
} else if (img.naturalWidth < img.naturalHeight) {
orientation = 'portrait';
} else {
orientation = 'even';
}
return orientation;
}