Ticket #28634: 28634.5.diff
File 28634.5.diff, 2.7 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-wp-image-editor-imagick.php
diff --git src/wp-includes/class-wp-image-editor-imagick.php src/wp-includes/class-wp-image-editor-imagick.php index 125ef0d..db41628 100644
class WP_Image_Editor_Imagick extends WP_Image_Editor { 317 317 * 318 318 * @param bool $strip_meta Whether to strip image metadata during resizing. Default true. 319 319 */ 320 $strip_meta = apply_filters( 'image_strip_meta', $strip_meta ); 321 322 // Strip image meta. 323 if ( $strip_meta ) { 324 $strip_result = $this->strip_meta(); 325 326 if ( is_wp_error( $strip_result ) ) { 327 return $strip_result; 328 } 320 if ( apply_filters( 'image_strip_meta', $strip_meta ) ) { 321 $this->strip_meta(); 329 322 } 330 323 331 324 try { … … class WP_Image_Editor_Imagick extends WP_Image_Editor { 658 651 * 659 652 * @since 4.5.0 660 653 * @access protected 661 *662 * @return true|WP_Error True if stripping metadata was successful. WP_Error object on error.663 654 */ 664 655 protected function strip_meta() { 665 try { 666 // Strip profiles. 667 foreach ( $this->image->getImageProfiles( '*', true ) as $key => $value ) { 668 if ( $key != 'icc' && $key != 'icm' ) { 669 $this->image->removeImageProfile( $key ); 670 } 671 } 656 $profiles = $this->image->getImageProfiles( 'icc', true ); 672 657 673 // Strip image properties. 674 if ( method_exists( $this->image, 'deleteImageProperty' ) ) { 675 $this->image->deleteImageProperty( 'comment' ); 676 $this->image->deleteImageProperty( 'Thumb::URI' ); 677 $this->image->deleteImageProperty( 'Thumb::MTime' ); 678 $this->image->deleteImageProperty( 'Thumb::Size' ); 679 $this->image->deleteImageProperty( 'Thumb::Mimetype' ); 680 $this->image->deleteImageProperty( 'software' ); 681 $this->image->deleteImageProperty( 'Thumb::Image::Width' ); 682 $this->image->deleteImageProperty( 'Thumb::Image::Height' ); 683 $this->image->deleteImageProperty( 'Thumb::Document::Pages' ); 684 } else { 685 $this->image->setImageProperty( 'comment', '' ); 686 $this->image->setImageProperty( 'Thumb::URI', '' ); 687 $this->image->setImageProperty( 'Thumb::MTime', '' ); 688 $this->image->setImageProperty( 'Thumb::Size', '' ); 689 $this->image->setImageProperty( 'Thumb::Mimetype', '' ); 690 $this->image->setImageProperty( 'software', '' ); 691 $this->image->setImageProperty( 'Thumb::Image::Width', '' ); 692 $this->image->setImageProperty( 'Thumb::Image::Height', '' ); 693 $this->image->setImageProperty( 'Thumb::Document::Pages', '' ); 694 } 695 } catch ( Exception $e ) { 696 return new WP_Error( 'image_strip_meta_error', $e->getMessage() ); 697 } 658 $this->image->stripImage(); 698 659 699 return true; 660 if ( ! empty( $profiles ) ) { 661 $this->image->profileImage( 'icc', $profiles['icc'] ); 662 } 700 663 } 701 664 702 665 }