I am using Imagick to resize images. Before I resize I attempt to get the width and height of the source file. What is happening is that when I use a portrait image, the returned width I get is actually the height and vice versa. It is as if the image has been rotated from portrait to landscape and then the width and height is returned.
My code is below:
$pdfPage = '128K_480x640.jpg';
$im = new imagick($pdfPage);
$im -> setResolution(600, 600);
$im -> setImageFormat('jpg');
$geo = $im->getImageGeometry();
$srcImgWidth = $geo['width'];
$srcImgHeight = $geo['height'];
$srcWHRatio = $srcImgWidth/$srcImgHeight;
echo 'orientation: '. $im->getImageOrientation().'<br>'; // 6
echo '$srcImgWidth: '.$srcImgWidth.'<br>';
echo '$srcImgHeight: '.$srcImgHeight.'<br>';
The image size was 480x640