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

WordPress Trac noreply at wordpress.org
Fri Nov 8 20:13:09 UTC 2024


#62365: HEIC upload conversion mappings may conflict with
`image_editor_output_format` overrides
----------------------------+-----------------------------
 Reporter:  ironprogrammer  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Media           |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 In testing #62359, I checked whether overriding the generated image type
 would be supported when the original upload is HEIC. Using the
 [https://make.wordpress.org/core/2024/02/23/wordpress-6-5-adds-avif-
 support/ 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.

 This is due to the resulting output from the filter, which includes
 [https://make.wordpress.org/core/2024/08/15/automatic-conversion-of-heic-
 images-to-jpeg-in-wordpress-6-7/ new default HEIC->JPEG mappings in 6.7].
 E.g. after applying the test filter, the output formats are:
 {{{
 {
  ["image/heic"]=> string(10) "image/jpeg"
  ["image/heif"]=> string(10) "image/jpeg"
  ["image/heic-sequence"]=> string(10) "image/jpeg"
  ["image/heif-sequence"]=> string(10) "image/jpeg"
  ["image/jpeg"]=> string(10) "image/avif"
 }
 }}}

 Should WordPress reconcile the mappings for conversion before returning
 [https://github.com/WordPress/wordpress-
 develop/blob/25d71f18fa9784f8a6d0e94518e7f04e2c17ecac/src/wp-
 includes/media.php#L6235 wp_get_image_editor_output_format()]? Extenders
 (like in [https://wordpress.org/plugins/webp-uploads/ Modern Image
 Formats]) could check this directly, but it seems WordPress should handle
 it for better consistency.

 ''(I also want to note that a quick test of remapping each of the HEIC
 types to AVIF ''does'' result in alt-size generated files being `.avif`.
 However, the original HEIC converted file remains JPEG if under the big
 image size threshold, so this goes deeper than the filter to achieve
 consistency. In the case of oversized images, they result in
 `-scaled.avif` for the converted file, as expected.)''

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


More information about the wp-trac mailing list