[wp-trac] [WordPress Trac] #62365: HEIC upload conversion mappings may conflict with `image_editor_output_format` overrides

WordPress Trac noreply at wordpress.org
Fri Feb 28 17:28:48 UTC 2025


#62365: HEIC upload conversion mappings may conflict with
`image_editor_output_format` overrides
-------------------------------------------------+-------------------------
 Reporter:  ironprogrammer                       |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.8
Component:  Media                                |     Version:  6.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests reporter-   |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by adamsilverstein):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests reporter-
     feedback


Comment:

 > I checked whether overriding the generated image type would be supported
 when the original upload is HEIC. Using the sample code from 6.5's AVIF
 support post, I felt it reasonable to expect a HEIC upload to result in
 AVIF files, but that was not the case.

 Thanks for the ticket.... however, I don't agree with the idea of chaining
 these transforms, I would rather update the documentation to make it
 clearer how to get the outputs you were expecting.

 The original idea of the `image_editor_output_format` filter was to **map
 upload mime type to output mime type**. So while the default transform for
 HEIC images is now JPEG, it can readily be set to output AVIF instead.
 Adding a transform from JPEG to AVIF means "uploaded JPEGs will be output
 as AVIFs" - uploading a HEIC will still output as JPEG, unless you
 explicitly set the mapping to transform HEIC to AVIF.

 My concerns with changing the filter behavior to "chain" output types
 include:
 * Unexpected/breaking change - what if the user wants HEIC to output as
 JPEG and JPEG uploads to be output as WebP. Currently that is possible,
 after this change it would not be
 * Circular chains - if the user somehow sets JPEG uploads to output as
 AVIF and AVIF uploads to output as JPEGs, what are the expected results?
 * Unpredictable output - currently the mapping is predictable, with
 chaining developers would need to know what other transforms are present
 to know what the output would be for a given upload type.

 Rather than altering the behavior of the filter, I suggest we update the
 original post introducing the filter (as well as the
 [https://make.wordpress.org/core/2024/08/15/automatic-conversion-of-heic-
 images-to-jpeg-in-wordpress-6-7 post] about the HEIC conversion). to
 explicitly explain how to set AVIF as the output format for HEIC uploads.
 If that sounds good, I am happy to make those updates. What do you think
 @ironprogrammer?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62365#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list