Ticket #21668: 21668.5.patch
File 21668.5.patch, 2.8 KB (added by , 11 years ago) |
---|
-
wp-includes/class-wp-image-editor-gd.php
344 344 if ( ! $filename ) 345 345 $filename = $this->generate_filename( null, null, $extension ); 346 346 347 if ( function_exists( 'imageinterlace' ) ) 348 imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) ); 349 347 350 if ( 'image/gif' == $mime_type ) { 348 351 if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) ) 349 352 return new WP_Error( 'image_save_error', __('Image Editor Save Failed') ); … … 389 392 public function stream( $mime_type = null ) { 390 393 list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type ); 391 394 395 if ( function_exists( 'imageinterlace' ) ) 396 imageinterlace( $image, apply_filters( 'image_save_progressive', false, $mime_type ) ); 397 392 398 switch ( $mime_type ) { 393 399 case 'image/png': 394 400 header( 'Content-Type: image/png' ); -
wp-includes/class-wp-image-editor-imagick.php
55 55 'getimageblob', 56 56 'getimagegeometry', 57 57 'getimageformat', 58 'getinterlacescheme', 58 59 'setimageformat', 59 60 'setimagecompression', 60 61 'setimagecompressionquality', 61 62 'setimagepage', 63 'setinterlacescheme', 62 64 'scaleimage', 63 65 'cropimage', 64 66 'rotateimage', … … 67 69 ); 68 70 69 71 // Now, test for deep requirements within Imagick. 70 if ( ! defined( ' imagick::COMPRESSION_JPEG' ) )72 if ( ! defined( 'Imagick::COMPRESSION_JPEG' ) || ! defined( 'Imagick::INTERLACE_PLANE' ) || ! defined( 'Imagick::INTERLACE_LINE' ) ) 71 73 return false; 72 74 73 75 if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) … … 420 422 try { 421 423 // Store initial Format 422 424 $orig_format = $this->image->getImageFormat(); 425 $orig_interlace = $this->image->getImageInterlaceScheme(); 423 426 424 427 $this->image->setImageFormat( strtoupper( $this->get_extension( $mime_type ) ) ); 428 if ( apply_filters( 'image_save_progressive', false, $mime_type ) ) { 429 $this->image->setImageInterlaceScheme( 430 strtoupper( $mime_type ) == 'PNG' ? 431 Imagick::INTERLACE_PLANE : 432 Imagick::INTERLACE_LINE 433 ); 434 } 425 435 $this->make_image( $filename, array( $image, 'writeImage' ), array( $filename ) ); 426 436 427 437 // Reset original Format 428 438 $this->image->setImageFormat( $orig_format ); 439 $this->image->setInterlaceScheme( $orig_interlace ); 429 440 } 430 441 catch ( Exception $e ) { 431 442 return new WP_Error( 'image_save_error', $e->getMessage(), $filename );