Make WordPress Core


Ignore:
Timestamp:
10/04/2014 01:11:38 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Fix setting default quality in WP_Image_Editor.

props markoheijnen.
fixes #29856 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor.php

    r28879 r29834  
    237237                 */
    238238                $quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );
    239 
    240                 if ( ! $this->set_quality( $quality ) ) {
    241                     $this->quality = $this->default_quality;
    242                 }
     239            }
     240
     241            if ( ! $this->set_quality( $quality ) ) {
     242                $this->quality = $this->default_quality;
    243243            }
    244244        }
     
    257257     */
    258258    public function set_quality( $quality = null ) {
     259        if ( null === $quality ) {
     260            $quality = $this->default_quality;
     261        }
     262
    259263        // Allow 0, but squash to 1 due to identical images in GD, and for backwards compatibility.
    260         if ( $quality == 0 ) {
     264        if ( 0 === $quality ) {
    261265            $quality = 1;
    262266        }
Note: See TracChangeset for help on using the changeset viewer.