note 108832 added to imagick.getimagepage
| From: | holdoffhunger at gmail dot com | Date: | Mon, 28 May 2012 22:53:43 +0000 |
| Subject: | note 108832 added to imagick.getimagepage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188271@lists.php.net to get a copy of this message | ||
The PHP function 'getImagePage' will return values indicating the height and width of an
image, just like the getHeight and getWidth, except these values are returned as an array.
There's also two other values returned in the array with the key values of 'x' and
'y'. After running this function on animated .Gif's, super-compressed jpeg's,
bmp's, png's, and every type of awkward file format you could think of, I kept getting
back the result of '0' for both the 'x' and 'y' associated values in
the returned array. It's likely that these indicate the "start-positions" of the
width and height, compared to the "end-values" you receive for accessing the values
associated with the keys 'width' and 'height'.
Oddly enough, the PHP function 'getPage' will return an array with the same exact keys,
except the values all default to '0', making it much less useful than the function
'getImagePage'.
And some sample code :
<?php
// Author: holdoffhunger@gmail.com
// Imagick Type
// ---------------------------------------------
$imagick_type = new Imagick();
// Open File
// ---------------------------------------------
$file_to_grab = "image_workshop_directory/test.gif";
$file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
// Grab File
// ---------------------------------------------
$imagick_type->readImageFile($file_handle_for_viewing_image_file);
// Get Image Page
// ---------------------------------------------
$image_page = $imagick_type->getImagePage();
// Print Iteration Value Interpreted
// ---------------------------------------------
print_r($image_page);
?>
Expected Result :
Array
(
[width] => 600
[height] => 450
[x] => 0
[y] => 0
)
----
Server IP: 69.147.83.197
Probable Submitter: 68.9.137.178
----
Manual Page -- http://www.php.net/manual/en/imagick.getimagepage.php
Edit -- https://master.php.net/note/edit/108832
Del: integrated -- https://master.php.net/note/delete/108832/integrated
Del: useless -- https://master.php.net/note/delete/108832/useless
Del: bad code -- https://master.php.net/note/delete/108832/bad+code
Del: spam -- https://master.php.net/note/delete/108832/spam
Del: non-english -- https://master.php.net/note/delete/108832/non-english
Del: in docs -- https://master.php.net/note/delete/108832/in+docs
Del: other reasons-- https://master.php.net/note/delete/108832
Reject -- https://master.php.net/note/reject/108832
Search -- https://master.php.net/manage/user-notes.php