Make WordPress Core


Ignore:
Timestamp:
09/19/2022 10:51:53 PM (19 months ago)
Author:
davidbaumwald
Message:

Media: Revert WebP generation.

Given Matt's recent post about removing WebP from core and possibly implementing the feature in a future Canonical Plugin, this change reverts changesets [54086], [54094], and [54097]. Additionally, [54210] contained a coding standards follow-up in one of the affected files that is no longer needed.

Reverts [54086], [54094], and [54097].

Props SergeyBiryukov.
See #55443.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r54173 r54226  
    39283928
    39293929/**
    3930  * Filters the default image output mapping.
    3931  *
    3932  * With this filter callback, WebP image files will be generated for certain JPEG source files.
    3933  *
    3934  * @since 6.1.0
    3935  *
    3936  * @param array $output_mapping Map of mime type to output format.
    3937  * @param string $filename  Path to the image.
    3938  * @param string $mime_type The source image mime type.
    3939  * @param string $size_name Optional. The image size name to create, or empty string if not set. Default empty string.
    3940  * @return array The adjusted default output mapping.
    3941  */
    3942 function wp_default_image_output_mapping( $output_mapping, $filename, $mime_type, $size_name = '' ) {
    3943     // If size name is specified, check whether the size supports additional MIME types like WebP.
    3944     if ( $size_name ) {
    3945         // Include only the core sizes that do not rely on add_image_size(). Additional image sizes are opt-in.
    3946         $enabled_sizes = array(
    3947             'thumbnail'      => true,
    3948             'medium'         => true,
    3949             'medium_large'   => true,
    3950             'large'          => true,
    3951             'post-thumbnail' => true,
    3952         );
    3953 
    3954         /**
    3955          * Filters the sizes that support secondary mime type output. Developers can use this
    3956          * to control the generation of additional mime type sub-sized images.
    3957          *
    3958          * @since 6.1.0
    3959          *
    3960          * @param array $enabled_sizes Map of size names and whether they support secondary mime type output.
    3961          */
    3962         $enabled_sizes = apply_filters( 'wp_image_sizes_with_additional_mime_type_support', $enabled_sizes );
    3963 
    3964         // Bail early if the size does not support additional MIME types.
    3965         if ( empty( $enabled_sizes[ $size_name ] ) ) {
    3966             return $output_mapping;
    3967         }
    3968     }
    3969 
    3970     $output_mapping['image/jpeg'] = 'image/webp';
    3971     return $output_mapping;
    3972 }
    3973 
    3974 /**
    39753930 * Prints default Plupload arguments.
    39763931 *
Note: See TracChangeset for help on using the changeset viewer.