} elseif ( 'image/png' ===
$mime_type ) { // Convert from full colors to index colors, like original PNG.
if ( function_exists( 'imageistruecolor'
) && !
imageistruecolor( $image ) ) { imagetruecolortopalette( $image, false,
imagecolorstotal( $image ) );
} if ( !
$this->
make_image( $filename, 'imagepng', array
( $image,
$filename ) ) ) { 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->
get_quality() ) ) ) { return new WP_Error( 'image_save_error',
__( 'Image Editor Save Failed'
) );
} } elseif ( 'image/webp' ==
$mime_type ) { if ( !
function_exists( 'imagewebp'
) || !
$this->
make_image( $filename, 'imagewebp', array
( $image,
$filename,
$this->
get_quality() ) ) ) { return new WP_Error( 'image_save_error',
__( 'Image Editor Save Failed'
) );
} } else { return new WP_Error( 'image_save_error',
__( 'Image Editor Save Failed'
) );
} // Set correct file permissions.