You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both the Gd/Image and Imagick/Image use some validation on the 'png_compression_filter'. This validation differs between the types which prevents seamless switching of the backends.
The GD version supports the Php GD constants, while the Imagick supports an integer between 0 and 9.
Imagick/Image.php : 690 and down
// second digit: compression filter (default: 5)if (isset($options['png_compression_filter'])) {
if ($options['png_compression_filter'] < 0 || $options['png_compression_filter'] > 9) {
thrownewInvalidArgumentException('png_compression_filter option should be an integer from 0 to 9');
}
$compression += $options['png_compression_filter'];
} else {
$compression += 5;
}
Gd/Image.php : 566 and down
if (isset($options['png_compression_filter'])) {
if (~PNG_ALL_FILTERS & $options['png_compression_filter']) {
thrownewInvalidArgumentException('png_compression_filter option should be a combination of the PNG_FILTER_XXX constants');
}
$args[] = $options['png_compression_filter'];
}
I think it would be a better idea to create your own constants and convert them to the specific output section when needed. This would centralize the validation code and remove duplicates.
I think it would also be nice to have some sort of writer factory to separate the specificities based on filetype, instead of having all jpeg and png checks in one method.
The text was updated successfully, but these errors were encountered:
First off, thank you :). I don't have really much time in my personal life to become a full maintainer, might do some small things. But I'll check with my employer if it's possible to throw in some company time ;).
Both the Gd/Image and Imagick/Image use some validation on the 'png_compression_filter'. This validation differs between the types which prevents seamless switching of the backends.
The GD version supports the Php GD constants, while the Imagick supports an integer between 0 and 9.
Imagick/Image.php
: 690 and downGd/Image.php
: 566 and downI think it would be a better idea to create your own constants and convert them to the specific output section when needed. This would centralize the validation code and remove duplicates.
I think it would also be nice to have some sort of writer factory to separate the specificities based on filetype, instead of having all jpeg and png checks in one method.
The text was updated successfully, but these errors were encountered: