Opened 3 years ago
Last modified 3 years ago
#53665 new defect (bug)
Incorrect mime type saved on attachment for scaled/rotated images processed with image_editor_output_format filter
Reported by: | ianmjones | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Media | Keywords: | needs-patch has-screenshots |
Focuses: | Cc: |
Description
When the image_editor_output_format
filter is used to change the format of jpeg images during the upload of a new large or rotated image, the mime type saved to the posts
table record is for the original_image
and not the -scaled
or -rotated
"full" size image that is used throughout the admin area.
Example filter:
add_filter( 'image_editor_output_format', function( $formats ) { $formats['image/jpeg'] = 'image/webp'; return $formats; } );
From an original file called "picture.jpg" this will produce a file called "picture-scaled.webp" that is used in the Media Library.
When viewing the details of the image from the Media Library's grid view, the overlay panel shows the mime type of the webp file as "image/jpeg". See attached screenshot for an example.
This may confuse some users.
It may also have a knock-on effect for themes or plugins that use the stored mime type rather than deduce it from a file's extension.
Attachments (1)
Change History (8)
This ticket was mentioned in Slack in #core-media by desrosj. View the logs.
3 years ago
#4
@
3 years ago
Seems there are two bugs here:
- Larger images: attachment post mime type is wrong.
- Smaller images are not converted after uploading.
Thinking that the original images smaller than the "big image threshold" should be converted. They are intended for use on the site/internet. Opened #53941 for that.
#5
@
3 years ago
- Keywords needs-patch has-screenshots added
- Milestone changed from 5.8.1 to 5.8.2
With less than 24 hours until 5.8.1 RC and no working patch, I'm going to punt this.
Screenshot of Media Library displaying incorrect mime type.