A PHP function to detect whether an image is portrait or landscape.