Ticket #28634: 28634.7.diff
File 28634.7.diff, 2.5 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..7fe4713 100644
class WP_Image_Editor_Imagick extends WP_Image_Editor { 662 662 * @return true|WP_Error True if stripping metadata was successful. WP_Error object on error. 663 663 */ 664 664 protected function strip_meta() { 665 /** 666 * Filter the list of image profile types that are not stripped. 667 * 668 * This filter only applies when resizing using the Imagick editor since GD 669 * strips all profiles by default. 670 * 671 * @since 4.5.0 672 * 673 * @param array $protected_profiles Array of protected profile types. Default 'icc' and 'iptc'. 674 */ 675 $protected_profiles = apply_filters( 'image_protected_profiles', array( 676 'icc', 677 'iptc', 678 'exif', 679 ) ); 680 665 681 try { 666 682 // Strip profiles. 667 683 foreach ( $this->image->getImageProfiles( '*', true ) as $key => $value ) { 668 if ( $key != 'icc' && $key != 'icm') {684 if ( ! in_array( $key, $protected_profiles ) && is_callable( array( $this->image, 'removeImageProfile' ) ) ) { 669 685 $this->image->removeImageProfile( $key ); 670 686 } 671 687 } 672 688 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 689 } catch ( Exception $e ) { 696 690 return new WP_Error( 'image_strip_meta_error', $e->getMessage() ); 697 691 }