Make WordPress Core

07/15/2021 09:09:33 PM (6 months ago)

Media: Document edge cases with the new image_editor_output_format filter.

More testing has revealed that the image_editor_output_format filter has some interesting edge cases that developers should be aware of when electing to use this filter (see #53667 and #53668).

Because this is a new filter that was intended to be used for experimenting with different ways to handle generating image sizes and has not yet been adopted in the wild, expanding the inline documentation is an acceptable temporary solution while these edge cases are explored further and addressed.

Props mikeschroder, antpb, desrosj, adamsilverstein, ianmjones.
Merges [51442] to the 5.8 branch.
See #53667, #53668, #35725.

2 edited


  • branches/5.8

  • branches/5.8/src/wp-includes/class-wp-image-editor.php

    r51221 r51444  
    323323         * the mapping array is empty, so the mime type matches the source image.
    324324         *
     325         * This should be considered experimental as there are a few edge cases that
     326         * still need to be solved.
     327         *
     328         * When this filter is used in combination with the {@see 'wp_editor_set_quality'}
     329         * filter, the image quality value used will be that of the original mime type,
     330         * not the mapped one. This could result in unexpected image quality for generated
     331         * images. See for more details.
     332         *
     333         * When a mime type is mapped to another, and two images with the same name are
     334         * uploaded (image.jpg and image.webp, for example), the generated images for one
     335         * will potentially overwrite the other's.
     336         * See for more details.
     337         *
    325338         * @see WP_Image_Editor::get_output_format()
    326339         *
Note: See TracChangeset for help on using the changeset viewer.