Changeset 29834
- Timestamp:
- 10/04/2014 01:11:38 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-gd.php
r29345 r29834 115 115 $this->mime_type = $size['mime']; 116 116 117 return true;117 return $this->set_quality(); 118 118 } 119 119 -
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r28879 r29834 141 141 142 142 $updated_size = $this->update_size(); 143 if ( is_wp_error( $updated_size ) ) 144 return $updated_size; 145 146 return true; 143 if ( is_wp_error( $updated_size ) ) { 144 return $updated_size; 145 } 146 147 return $this->set_quality(); 147 148 } 148 149 -
trunk/src/wp-includes/class-wp-image-editor.php
r28879 r29834 237 237 */ 238 238 $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; 243 243 } 244 244 } … … 257 257 */ 258 258 public function set_quality( $quality = null ) { 259 if ( null === $quality ) { 260 $quality = $this->default_quality; 261 } 262 259 263 // Allow 0, but squash to 1 due to identical images in GD, and for backwards compatibility. 260 if ( $quality == 0) {264 if ( 0 === $quality ) { 261 265 $quality = 1; 262 266 } -
trunk/tests/phpunit/tests/image/editor.php
r28879 r29834 53 53 $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 54 54 55 // Check default value 56 $this->assertEquals( 90, $editor->get_quality() ); 57 55 58 // Ensure set_quality works 56 59 $this->assertTrue( $editor->set_quality( 75 ) ); … … 60 63 $func = create_function( '', "return 100;"); 61 64 add_filter( 'wp_editor_set_quality', $func ); 62 $this->assertTrue( $editor->set_quality( 7 5) );63 $this->assertEquals( 7 5, $editor->get_quality() );65 $this->assertTrue( $editor->set_quality( 70 ) ); 66 $this->assertEquals( 70, $editor->get_quality() ); 64 67 65 68 // Clean up -
trunk/tests/phpunit/tests/image/editor_gd.php
r29120 r29834 464 464 465 465 $editor = wp_get_image_editor( $file ); 466 467 $this->assertNotInstanceOf( 'WP_Error', $editor ); 468 466 469 $editor->load(); 467 470 $editor->resize( 5, 5 ); … … 484 487 485 488 $editor = wp_get_image_editor( $file ); 489 490 $this->assertNotInstanceOf( 'WP_Error', $editor ); 491 486 492 $editor->load(); 487 493 -
trunk/tests/phpunit/tests/image/editor_imagick.php
r29120 r29834 464 464 465 465 $editor = wp_get_image_editor( $file ); 466 467 $this->assertNotInstanceOf( 'WP_Error', $editor ); 468 466 469 $editor->load(); 467 470 $editor->resize( 5, 5 ); … … 484 487 485 488 $editor = wp_get_image_editor( $file ); 489 490 $this->assertNotInstanceOf( 'WP_Error', $editor ); 491 486 492 $editor->load(); 487 493 -
trunk/tests/phpunit/tests/image/functions.php
r29120 r29834 225 225 // Save the image as each file extension, check the mime type 226 226 $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); 227 $this->assertNotInstanceOf( 'WP_Error', $img ); 228 227 229 $temp = get_temp_dir(); 228 230 foreach ( $mime_types as $ext => $mime_type ) {
Note: See TracChangeset
for help on using the changeset viewer.