Closed korridor closed 6 months ago
@korridor We'd be happy to accept a PR that fixes this! :+1:
A PR with just a failing test would be welcome too (sounds like a good first issue).
I've made a PR for this issue: https://github.com/spatie/image-optimizer/pull/216
I just merged and published the PR, thank you!
I use a custom optimizer and register this optimizer in the config
media-library.image_optimizers
. Since the major 11 upgrade, the custom optimizer does not get called at all. If I add logs to thecanHandle
andgetCommand
function, nothing happens. If I downgrade, it works again, without changing anything else.I debugged the problem a bit, and it looks to me like the problem is somewhere here:
The
laravel-medialibrary
only uses theimage_optimizers
config here to create theOptimizerChainFactory
: https://github.com/spatie/laravel-medialibrary/blob/3bb61aec3505055a18323afb348ca425161019fd/src/Conversions/Conversion.php#L40In the OptimizerChainFactory (https://github.com/spatie/image-optimizer/blob/02e2717c31334646f00a0e25cf5edbf41bd20ac3/src/OptimizerChainFactory.php#L15) the
$config
is being used, but it ignores custom optimizers, since the optimizers are redefined here. (https://github.com/spatie/image-optimizer/blob/02e2717c31334646f00a0e25cf5edbf41bd20ac3/src/OptimizerChainFactory.php#L35)