Ticket #21668: 21668.6.patch
File 21668.6.patch, 2.6 KB (added by , 11 years ago) |
---|
-
wp-includes/class-wp-image-editor-imagick.php
67 67 ); 68 68 69 69 // Now, test for deep requirements within Imagick. 70 if ( ! defined( ' imagick::COMPRESSION_JPEG' ) )70 if ( ! defined( 'Imagick::COMPRESSION_JPEG' ) ) 71 71 return false; 72 72 73 73 if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) … … 433 433 $orig_format = $this->image->getImageFormat(); 434 434 435 435 $this->image->setImageFormat( strtoupper( $this->get_extension( $mime_type ) ) ); 436 437 if ( method_exists( $this->image, 'getImageInterlaceScheme' ) && method_exists( $this->image, 'setImageInterlaceScheme' ) && apply_filters( 'image_save_progressive', false, $mime_type ) ) { 438 $orig_interlace = $this->image->getImageInterlaceScheme(); 439 440 if( strtoupper( $mime_type ) == 'PNG' && defined( 'Imagick::INTERLACE_PLANE' ) ) 441 $this->image->setImageInterlaceScheme( Imagick::INTERLACE_PLANE ); 442 else if( defined( 'Imagick::INTERLACE_LINE' ) ) 443 $this->image->setImageInterlaceScheme( Imagick::INTERLACE_LINE ); 444 } 445 436 446 $this->make_image( $filename, array( $image, 'writeImage' ), array( $filename ) ); 437 447 438 448 // Reset original Format 439 449 $this->image->setImageFormat( $orig_format ); 450 451 if( isset( $orig_interlace ) ) 452 $this->image->setInterlaceScheme( $orig_interlace ); 440 453 } 441 454 catch ( Exception $e ) { 442 455 return new WP_Error( 'image_save_error', $e->getMessage(), $filename ); -
wp-includes/class-wp-image-editor-gd.php
348 348 if ( ! $filename ) 349 349 $filename = $this->generate_filename( null, null, $extension ); 350 350 351 if ( function_exists( 'imageinterlace' ) ) 352 imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) ); 353 351 354 if ( 'image/gif' == $mime_type ) { 352 355 if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) ) 353 356 return new WP_Error( 'image_save_error', __('Image Editor Save Failed') ); … … 393 396 public function stream( $mime_type = null ) { 394 397 list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type ); 395 398 399 if ( function_exists( 'imageinterlace' ) ) 400 imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) ); 401 396 402 switch ( $mime_type ) { 397 403 case 'image/png': 398 404 header( 'Content-Type: image/png' );