- Issue created by @thejimbirch
- π§πͺBelgium dieterholvoet Brussels
You'll be able to do this once β¨ Alter hook to adjust image effect RTBC lands, or you can start using the patch now:
/** * Implements hook_easy_responsive_images_image_style_alter(). */ function my_module_easy_responsive_images_image_style_alter(ImageStyleInterface $entity): void { foreach ($entity->getEffects() as $effect) { if ($effect->getPluginId() === 'image_convert') { return; } } $entity->addImageEffect([ 'id' => 'image_convert', 'data' => [ 'extension' => 'webp', ], ]); }
- πΊπΈUnited States fathershawn New York
Perhaps I'm missing something but a default pipeline using ImageAPI Optimize and a processor like ImageAPI Optimize AVIF WebP β takes care of this.
- π§πͺBelgium dieterholvoet Brussels
ImageAPI Optimize introduces an overhead and is very much overkill if all you want to do is convert images to Webp, because this is supported by core image styles.
- π§πͺBelgium kubrick
The module used to convert to webp if you had eighter imageapi_optimize_webp or the webp module, but there's been a regression in the latest version when avif support was added.
I agree #2 would be a more elegant solution since it does not require any extra modules.
Not sure if I should open a new issue for this or we should just focus on getting β¨ Alter hook to adjust image effect RTBC to stable.
For now I've added my fixes in a patch.
It should serve avif, webp or fall back to the original format depending on which modules you have installed. - π§πͺBelgium dieterholvoet Brussels
You should probably open a new issue for that regression, because Iβm not sure if β¨ Alter hook to adjust image effect RTBC is going anywhere soon.
- π³π±Netherlands seanB Netherlands
Merged β¨ Alter hook to adjust image effect RTBC ! I think the patch in #5 makes sense, but could you create a new issue for that with an MR? I'd be glad to merge that as well.
Regarding this issue, I guess if we could drop special support for the avif, webp and imageapi_optimize_webp modules now
image_convert
is in core. At least that makes sense.Maybe we could create a setting in the module to select if we want to convert images to avif or webp automatically, and add the
image_convert
action to all generated image styles?