imagick icon indicating copy to clipboard operation
imagick copied to clipboard

getImageAlphaChannel should return a boolean instead of an integer - docs need updating

Open mlocati opened this issue 2 years ago • 8 comments

The ImageMagick MagickGetImageAlphaChannel function returns a boolean, but the getImageAlphaChannel method returns an int

See:

mlocati avatar Oct 12 '21 09:10 mlocati

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.

Danack avatar Oct 23 '21 14:10 Danack

I checked manually the imagemagick source code to see the meaning of the returned value, and I saw it was only a boolean

mlocati avatar Oct 23 '21 15:10 mlocati

cool. Will be in next release.

Danack avatar Oct 24 '21 13:10 Danack

:+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

phpsyscoder avatar Dec 11 '21 06:12 phpsyscoder

@petrich Cool, go for it - https://github.com/php/doc-en/blob/master/reference/imagick/imagick/getimagealphachannel.xml

Danack avatar Dec 11 '21 14:12 Danack

ohh... im not familiar with updating the php docu. @Danack can you do it?

phpsyscoder avatar Dec 12 '21 16:12 phpsyscoder

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.

Danack avatar Dec 14 '21 16:12 Danack

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

Daijobou avatar Jan 28 '22 05:01 Daijobou