imagick
imagick copied to clipboard
getImageAlphaChannel should return a boolean instead of an integer - docs need updating
The ImageMagick MagickGetImageAlphaChannel
function returns a boolean, but the getImageAlphaChannel
method returns an int
See:
- ImageMagick version 6.5.5 (the oldest one I can find in the repo)
- ImageMagick version 6.9.4
- ImageMagick version 7.0.1
- ImageMagick version 7.1.0
Thanks. Did you just spot this by eye or have an automated way of checking?
Just trying to figure out if it's likely that others might be incorrect.
I checked manually the imagemagick source code to see the meaning of the returned value, and I saw it was only a boolean
cool. Will be in next release.
:+1: ... Docu should also be updated... with a version notice of changed return value from int to bool https://www.php.net/manual/en/imagick.getimagealphachannel
@petrich Cool, go for it - https://github.com/php/doc-en/blob/master/reference/imagick/imagick/getimagealphachannel.xml
ohh... im not familiar with updating the php docu. @Danack can you do it?
One of the problems with open source is leaving issues that other people can do, while the maintainer(s) does stuff that is too difficult to pass off.
This undocumented change (not found in changelog) break older code like this one:
if ($watermark->getImageAlphaChannel() !== Imagick::ALPHACHANNEL_ACTIVATE)
Source https://github.com/koseven/koseven/blob/master/modules/image/classes/Kohana/Image/Imagick.php#L203
It is by the way a bit strange that the function now returns boolean but the constant remains an integer.
imagick::ALPHACHANNEL_ACTIVATE (int) This constant is available if Imagick has been compiled against ImageMagick version 6.3.8 or higher.
Source https://www.php.net/manual/en/imagick.constants.php#imagick.constants.alphachannel-activate