Req #64862 [Opn->Sus]: imagecopyresized doesn't handle negative width/height
| From: | cmb@php.net | Date: | Mon, 23 Jan 2017 13:51:06 +0000 |
| Subject: | Req #64862 [Opn->Sus]: imagecopyresized doesn't handle negative width/height | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206890@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64862&edit=1
ID: 64862
Updated by: cmb@php.net
Reported by: matteosistisette at gmail dot com
Summary: imagecopyresized doesn't handle negative
width/height
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: GD related
PHP Version: 5.3.25
Block user comment: N
Private report: N
New Comment:
Personally, I would prefer to remove such compound operations as
imagecopyresized() and imagecopyresampled(), as imagescale()
already offers improved resizing capabilities, which most likely
will never be backported to the old imagecopyre(sized|sampled)().
The fact that imageflip() is available as of PHP 5.5 only is not
a hindrance anymore, as the active support of PHP 5 has already
ended.
Therefore this feature request requires the RFC process[1]. If
anybody still wants this feature, please write to internals; I'm
suspending this ticket for the time being.
Also consider to request this feature for libgd[2]; if it would be
implemented there, allowing PHP to pass negative values to enforce
flipping would be a no-brainer.
[1] <http://wiki.php.net/rfc/howto>
[2] <https://github.com/libgd/libgd/issues>
Previous Comments:
------------------------------------------------------------------------
[2013-05-16 18:18:31] matteosistisette at gmail dot com
Description:
------------
There's no reason why imagecopyresized shouldn't accept and properly handle a
negative width and/or height as source or target dimentions.
It's perfectly natural to copy a rectanguar region of an image while applying it
a negative scale so as to flip it. It's totally ridiculous that you have to copy,
flip and then copy it again resized. Especially considering that prior to 5.5
imageflip doesn't even exist.
At the very least negative dimensions should be supported on either source or
target, though the normal way would be to support both.
Test script:
---------------
imagecopyresized($img,$img,0,$h=imagesy($img),0,0,$w=imagesx($img),-$h,$w,$h);
OR
imagecopyresized($img,$img,0,0,0,$h=imagesy($img),$w=imagesx($img),$h,$w,-$h);
Expected result:
----------------
image should be flipped vertically
Actual result:
--------------
An error is issued:
imagecopyresized(): Invalid image dimensions
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64862&edit=1