Skip to content

Instantly share code, notes, and snippets.

@adamsilverstein
Created July 8, 2022 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamsilverstein/b0836b1a064b82f62351c8935f9a8be6 to your computer and use it in GitHub Desktop.
Save adamsilverstein/b0836b1a064b82f62351c8935f9a8be6 to your computer and use it in GitHub Desktop.
diff --git a/src/wp-includes/class-wp-image-editor.php b/src/wp-includes/class-wp-image-editor.php
index 6b63d7e9fd..e17b787223 100644
--- a/src/wp-includes/class-wp-image-editor.php
+++ b/src/wp-includes/class-wp-image-editor.php
@@ -414,12 +414,10 @@ abstract class WP_Image_Editor {
$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
}
- if ( $mime_type && ( $mime_type !== $this->mime_type ) ) {
- // The image will be converted when saving. Set the quality for the new mime-type if not already set.
- if ( $mime_type !== $this->output_mime_type ) {
- $this->output_mime_type = $mime_type;
- $this->set_quality();
- }
+ if ( $mime_type && ( $mime_type !== $this->output_mime_type ) ) {
+ // The image will be converted when saving. Set the quality for the new mime-type.
+ $this->output_mime_type = $mime_type;
+ $this->set_quality();
} elseif ( ! empty( $this->output_mime_type ) ) {
// Reset output_mime_type and quality.
$this->output_mime_type = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment