mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-02 00:00:15 +00:00
Fix setting default quality in WP_Image_Editor.
props markoheijnen. fixes #29856 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@29834 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -236,10 +236,10 @@ abstract class WP_Image_Editor {
|
||||
* @param string $context Context of the filter.
|
||||
*/
|
||||
$quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );
|
||||
}
|
||||
|
||||
if ( ! $this->set_quality( $quality ) ) {
|
||||
$this->quality = $this->default_quality;
|
||||
}
|
||||
if ( ! $this->set_quality( $quality ) ) {
|
||||
$this->quality = $this->default_quality;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,8 +256,12 @@ abstract class WP_Image_Editor {
|
||||
* @return boolean|WP_Error True if set successfully; WP_Error on failure.
|
||||
*/
|
||||
public function set_quality( $quality = null ) {
|
||||
if ( null === $quality ) {
|
||||
$quality = $this->default_quality;
|
||||
}
|
||||
|
||||
// Allow 0, but squash to 1 due to identical images in GD, and for backwards compatibility.
|
||||
if ( $quality == 0 ) {
|
||||
if ( 0 === $quality ) {
|
||||
$quality = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user