Changeset 56271 for trunk/src/wp-includes/class-wp-image-editor-imagick.php
- Timestamp:
- 07/19/2023 10:33:47 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r56250 r56271 169 169 } 170 170 171 if ( 'pdf' === $file_extension ) { 172 $this->remove_pdf_alpha_channel(); 173 } 174 171 175 $this->mime_type = $this->get_mime_type( $this->image->getImageFormat() ); 172 176 } catch ( Exception $e ) { … … 753 757 754 758 /** 759 * Removes PDF alpha after it's been read. 760 * 761 * @since 6.4.0 762 */ 763 protected function remove_pdf_alpha_channel() { 764 $version = Imagick::getVersion(); 765 // Remove alpha channel if possible to avoid black backgrounds for Ghostscript >= 9.14. RemoveAlphaChannel added in ImageMagick 6.7.5. 766 if ( $version['versionNumber'] >= 0x675 ) { 767 try { 768 // Imagick::ALPHACHANNEL_REMOVE mapped to RemoveAlphaChannel in PHP imagick 3.2.0b2. 769 $this->image->setImageAlphaChannel( defined( 'Imagick::ALPHACHANNEL_REMOVE' ) ? Imagick::ALPHACHANNEL_REMOVE : 12 ); 770 } catch ( Exception $e ) { 771 return new WP_Error( 'pdf_alpha_process_failed', $e->getMessage() ); 772 } 773 } 774 } 775 776 /** 755 777 * @since 3.5.0 756 778 * @since 6.0.0 The `$filesize` value was added to the returned array.
Note: See TracChangeset
for help on using the changeset viewer.