In WP_Image_Editor_GD::_save()
, pass $compression_level
into the args array for ->make_image()
.
Props MuViMoTV, markoheijnen, SergeyBiryukov, mikemanger, ericlewis. Fixes #24380. git-svn-id: https://develop.svn.wordpress.org/trunk@28640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
804b82bd11
commit
2d0be44d85
@ -383,9 +383,16 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
if ( function_exists('imageistruecolor') && ! imageistruecolor( $image ) )
|
||||
imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
|
||||
|
||||
if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) )
|
||||
/*
|
||||
* Invert the 1-100 quality scale and constrain it to 0-9,
|
||||
* as per imagepng()'s peculiar quality parameter.
|
||||
*/
|
||||
$compression_level = floor( ( 101 - $this->quality ) * 0.09 );
|
||||
|
||||
if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename, $compression_level ) ) ) {
|
||||
return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
|
||||
}
|
||||
}
|
||||
elseif ( 'image/jpeg' == $mime_type ) {
|
||||
if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, $this->quality ) ) )
|
||||
return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
|
||||
|
Loading…
Reference in New Issue
Block a user