WordPress.org

Make WordPress Core

Ticket #24380: 24380.diff

File 24380.diff, 817 bytes (added by SergeyBiryukov, 4 years ago)
  • wp-includes/class-wp-image-editor-gd.php

     
    353353                        if ( function_exists('imageistruecolor') && ! imageistruecolor( $image ) )
    354354                                imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
    355355
    356                         if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) )
     356                        $compression = round( 9 - 0.09 * $this->quality ); // from 0 (no compression) to 9.
     357                       
     358                        if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename, $compression ) ) )
    357359                                return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
    358360                }
    359361                elseif ( 'image/jpeg' == $mime_type ) {