trouble with getimageresolution and getimagegeometry

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
goonatic

trouble with getimageresolution and getimagegeometry

Post by goonatic »

So far most imagick functions work for me. I seem to be having problems with the functions that return arrays.

$im = new Imagick();
$filename = 'junk.jpg';
$im -> readImage($filename);
$photobytes = $im ->getImageSize();
$photoheight = $im ->getImageHeight();
$photowidth = $im ->getImageWidth();
// the above functions work and return values that I expect
//the functions below do not return any values
$geometry = $im->getImageGeometry();
$geomX = $geometry[0];
$geomY = $geometry[1];
$resolution = $im->getImageResolution();
$resX = $resolution[0];
$resY = $resolution[1];

The resolution and geometry arrays are empty.
Am I missing something simple?

Thanks,
Mark
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: trouble with getimageresolution and getimagegeometry

Post by mkoppanen »

$im = new imagick( "a.jpg" );
var_dump( $im->getImageGeometry() );

array(2) {
["width"]=>
int(775)
["height"]=>
int(1386)
}

It is an associative array.
Mikko Koppanen
My blog: http://valokuva.org
goonatic

Re: trouble with getimageresolution and getimagegeometry

Post by goonatic »

Thanks Mikko,
That was it. I knew it was something simple.

Mark
Post Reply