From da0ce4038f572b024d7cf38005596a6f7e98d7fa Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 27 Apr 2022 05:21:08 +0000 Subject: [PATCH] Media: Ensure `wp_crop_image()` returns correct file type. Return the correct file path from `wp_crop_image()` when a developer modifies the file type with via the `image_editor_output_format` filter. Previously the function would return a broken file reference containing the original file extension rather than the one specified via the filter. Props mat-lipe, adamsilverstein. Fixes #55403. Built from https://develop.svn.wordpress.org/trunk@53292 git-svn-id: http://core.svn.wordpress.org/trunk@52881 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 2818b3dd5d..136f6dcdab 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -63,6 +63,10 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s return $result; } + if ( ! empty( $result['path'] ) ) { + return $result['path']; + } + return $dst_file; } diff --git a/wp-includes/version.php b/wp-includes/version.php index ceaab58634..8a7e61e056 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta3-53291'; +$wp_version = '6.0-beta3-53292'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.