(function() { var orientation, img = new Image(); img.onload = function () { if (img.naturalWidth > img.naturalHeight) { orientation = 'landscape'; } else if (img.naturalWidth < img.naturalHeight) { orientation = 'portrait'; } else { orientation = 'even'; } document.body.innerHTML += '
' + orientation + '
'; } img.src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/130527/flower-300x259.jpg"; })();