Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.79k stars 1.5k forks source link

Bugfix: Filter out parameter that do not match target encoder #1333

Closed olivervogel closed 2 months ago

olivervogel commented 3 months ago

This deals with the problem that arises when format-unspecific encoders are provided with parameters that are not present in the final target encoder.

For example, the following call can take place with the quality argument.

// works if $image was created from jpeg, errors if image source is png for example
$encoded = $image->encode(new AutoEncoder(quality: 5));

If the source image and thus the target encoder supports quality (e.g. Jpeg), everything works fine. However, if the input format does not contain quality in the target encoder (e.g. PNG), an error occurs.

Unknown named parameter $quality

The logic has only been adapted since version 3.6, so this does not affect previous versions.

See #1332