I build a simple function with getimagesize to find out if an image is horizontal or vertical.
// get height and width and then return
list($width, $height) = getimagesize('/path/to/imag.jpg');
if ($width > $height || $width == $height) {
return 'HORIZONTAL';
} elseif ($height > $width) {
return 'VERTICAL';
}
But this seems to fail on some images. Especially on a picture that is taken with a mobile device, holding it vertical. Photoshop opens it and shows it vertical, Mac Preview does too, but getimagesize keeps telling me width is bigger than height.
So I assume the information, this "horizontal" image should be shown "vertical" in Photo application is stored somewhere else.....
But where.... Exif?