Changeset 54226 for trunk/src/wp-includes/media.php
- Timestamp:
- 09/19/2022 10:51:53 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r54173 r54226 3928 3928 3929 3929 /** 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.03935 *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 this3956 * to control the generation of additional mime type sub-sized images.3957 *3958 * @since 6.1.03959 *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 /**3975 3930 * Prints default Plupload arguments. 3976 3931 *
Note: See TracChangeset
for help on using the changeset viewer.