Wrong file header returned, when converting an image for example to webp

Created on 21 September 2022, over 2 years ago
Updated 23 February 2023, almost 2 years ago

Problem/Motivation

When converting images using an image style, to webp (as typical use-case, but I guess it might be the same for other formats), the resulting MIME return type of the image stays the old one:

Steps to reproduce

  1. Set up an image style and use the "Convert" action to convert the source image (e.g. jpg) to webp (as of #2340699: Let GDToolkit support WEBP image format ), which was a great addition to Drupal 9.2 to allow webp generation by core: https://www.drupal.org/node/3171135
  2. Get the image and have a look at the returned type header. It's not image/webp as expected , but still the old format.

I'm using Firefox on Windows.
Chrome is even crazier and returns type "document" for the webp image.

Google Page speed also complains

Serve images in modern formats

but shows the .webp files as an example for files to be optimized. This is also unexpected, and I guess due to the wrong headers returned.

Proposed resolution

Return the correct MIME type for the converted image.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.1

Component
Image system 

Last updated 1 day ago

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024