Doc #64472 [NEW]: Flip-flipped argument handling not documented

From: Date: Wed, 20 Mar 2013 21:32:58 +0000
Subject: Doc #64472 [NEW]: Flip-flipped argument handling not documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9673@lists.php.net to get a copy of this message
From:             psmith at gurutechnologies dot net
Operating system: Ubuntu
PHP version:      Irrelevant
Package:          imagick
Bug Type:         Documentation Problem
Bug description:Flip-flipped argument handling not documented

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 bug report at https://bugs.php.net/bug.php?id=64472&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=64472&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=64472&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=64472&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64472&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64472&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64472&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64472&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64472&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64472&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64472&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=64472&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=64472&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64472&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64472&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64472&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64472&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64472&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64472&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64472&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64472&r=mysqlcfg



Thread (2 messages)

« previous php.doc.bugs (#9673) next »