Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #62305, comment 34


Ignore:
Timestamp:
11/06/2024 05:17:21 PM (5 weeks ago)
Author:
flixos90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62305, comment 34

    initial v1  
    22
    33* The bug reported by @mukesh27 above is an actual bug in the Modern Image Formats plugin itself, that as I now discovered has been there for quite a while, but so far was only "exposed" by big images, which we didn't have test coverage for. 😞 More context in https://github.com/WordPress/performance/pull/1635#issuecomment-2460323575. So this needs to be fixed in the plugin.
    4 * As a separate problem, [59317] does not check which MIME type to convert an image to. The `image_editor_output_format` can be used with an output array for each MIME type, and the Modern Image Formats plugin may specify the MIME type itself there too. For example, "for JPEG" input, the valid output format is "JPEG" and/or "WebP". If you think about it as a conversion map, this may seem weird, but the filter is about "output format", not "conversion map", so we cannot assume it's only used as the latter. Core may therefore currently try to convert a JPEG to a JPEG, which it shouldn't even attempt. We should only set the `$convert` flag to `true` if the output format only contains MIME types that differ from the input MIME type.
     4* As a separate more minor problem, [59317] does not check which MIME type to convert an image to. The `image_editor_output_format` can receive the same output as input MIME type. The Modern Image Formats plugin for example specifies it dynamically, depending on the configuration. It's definitely possible for the filter to include a map entry from `image/jpeg` to `image/jpeg` for example. If you think about it as a conversion map, this may seem weird, but the filter is about "output format", not "conversion map", so we cannot assume it's only used as the latter. Core may therefore currently try to convert a JPEG to a JPEG, which it shouldn't even attempt. We should only set the `$convert` flag to `true` if the output format only contains MIME types that differ from the input MIME type.