diff --git src/wp-includes/class-wp-image-editor.php src/wp-includes/class-wp-image-editor.php
index 7dcdc91d5a..404b66c30b 100644
|
|
abstract class WP_Image_Editor { |
295 | 295 | protected function get_output_format( $filename = null, $mime_type = null ) { |
296 | 296 | $new_ext = null; |
297 | 297 | |
| 298 | /** |
| 299 | * Filters the image editor output format. |
| 300 | * |
| 301 | * Enables filtering the mime type used to save images. By default, |
| 302 | * the mime type matches the source image. |
| 303 | * |
| 304 | * @see src/wp-includes/class-wp-image-editor.php -> get_output_format() |
| 305 | * |
| 306 | * @since 5.8.0 |
| 307 | * |
| 308 | * @param array $wp_image_editor_output_format { |
| 309 | * An array of mime type mappings. Maps a source mime type to a new |
| 310 | * destination mime type. Empty by default. |
| 311 | * |
| 312 | * @type array $mime_type The source mime type { |
| 313 | * @type string $mime_type The new mime type. |
| 314 | * } |
| 315 | * @param string $filename Path to the image. |
| 316 | * @param string $mime_type The source image mime type. |
| 317 | * } |
| 318 | */ |
| 319 | $wp_image_editor_output_format = apply_filters( 'wp_image_editor_output_format', array(), $filename, $mime_type ); |
| 320 | |
| 321 | if ( |
| 322 | isset( $wp_image_editor_output_format[ $mime_type ] ) && |
| 323 | this->supports_mime_type( $wp_image_editor_output_format[ $mime_type ] ) |
| 324 | ) { |
| 325 | $mime_type = $wp_image_editor_output_format[ $mime_type ]; |
| 326 | } |
| 327 | |
298 | 328 | // By default, assume specified type takes priority. |
299 | 329 | if ( $mime_type ) { |
300 | 330 | $new_ext = $this->get_extension( $mime_type ); |