Images styles should be converted to WebP

Created on 19 June 2024, 3 months ago
Updated 4 September 2024, 24 days ago

Problem/Motivation

Drupal core's image styles are now converted to webP. https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/image...

Is it possible for this module to create WebP images for each of the generated image styles?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 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.

Production build 0.71.5 2024