Skip to content

Commit

Permalink
Media: Only mark an image as requiring conversion if the output forma…
Browse files Browse the repository at this point in the history
…t differs from the input format.

Follow up to [59317] and [59346].

Props adamsilverstein, peterwilsoncc.
See #62305.


git-svn-id: https://develop.svn.wordpress.org/trunk@59366 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
felixarntz committed Nov 6, 2024
1 parent 8ad5281 commit 05d37f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wp-admin/includes/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
// The image may need to be converted regardless of its dimensions.
$output_format = wp_get_image_editor_output_format( $file, $imagesize['mime'] );

if ( is_array( $output_format ) && array_key_exists( $imagesize['mime'], $output_format ) ) {
if (
is_array( $output_format ) &&
array_key_exists( $imagesize['mime'], $output_format ) &&
$output_format[ $imagesize['mime'] ] !== $imagesize['mime']
) {
$convert = true;
}
}
Expand Down

0 comments on commit 05d37f0

Please sign in to comment.