Doc #64472 [Opn->Csd]: Flip-flipped argument handling not documented
Edit report at https://bugs.php.net/bug.php?id=64472&edit=1
ID: 64472
Updated by: danack@php.net
Reported by: psmith at gurutechnologies dot net
Summary: Flip-flipped argument handling not documented
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: imagick
Operating System: Ubuntu
PHP Version: Irrelevant
-Assigned To:
+Assigned To: danack
Block user comment: N
Private report: N
New Comment:
Added to manual, it will be there after the next build.
Previous Comments:
------------------------------------------------------------------------
[2013-03-20 21:32:58] psmith at gurutechnologies dot net
Description:
------------
---
From manual page: http://www.php.net/imagick.extentimage
---
Undocumented flip-flop in argument interpretation on Imagick::extentImage(int $width, int $height,
int $x, int $y):
Prior to ImageMagick 6.5.7-8 (1623), $x was positive when shifting to the left and negative when
shifting to the right, and $y was positive when shifting an image up and negative when shifting an
image down.
Somewhere betwen ImageMagick 6.3.7 (1591) and ImageMagick 6.5.7-8 (1623), the axes of $x and $y were
flipped, so that $x was negative when shifting to the left and positive when shifting to the right,
and $y was negative when shifting an image up and positive when shifting an image down.
Somewhere between ImageMagick 6.5.7-8 (1623) and ImageMagick 6.6.9-7 (1641), the axes of $x and $y
were flipped back to pre-ImageMagick 6.5.7-8 (1623) functionality.
Test script:
---------------
<?php
$imagick = new Imagick();
$imagick_version = $imagick->getVersion();
if($imagick_version['versionNumber'] == 1623)
$pos_factor = 1;
else
$pos_factor = -1;
$imagick->readImage($path_to_some_image_to_center);
$imagick->resizeImage($new_width, $new_height, imagick::FILTER_LANCZOS, 1);
$imagick->setImageBackgroundColor(new ImagickPixel('#000000'));
$imagick->extentImage($max_width, $max_height, $pos_factor * ($max_width - $new_width) / 2,
$pos_factor * ($max_height - $new_height) / 2);
?>
Expected result:
----------------
Using the above code to scale and fit image, centered, into an incongruent container should result
in a properly centered image.
Actual result:
--------------
If $x and $y do not use the signs (positive or negative) expected by the installed version of
Imagick, the image is shifted in the wrong direction! This should be noted in the documentation as
a warning.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64472&edit=1
Thread (2 messages)