Req #64862 [Sus->Wfx]: imagecopyresized doesn't handle negative width/height

From: Date: Wed, 25 Aug 2021 13:50:07 +0000
Subject: Req #64862 [Sus->Wfx]: imagecopyresized doesn't handle negative width/height
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236067@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: Suspended +Status: Wont fix Type: Feature/Change Request Package: GD related PHP Version: 5.3.25 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Given the lack of further feedback, I'm closing as WONTFIX. Previous Comments: ------------------------------------------------------------------------ [2017-01-23 13:51:04] cmb@php.net 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> ------------------------------------------------------------------------ [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

« previous php.bugs (#236067) next »