Ticket #48853: 48853.diff
File 48853.diff, 1.3 KB (added by , 4 years ago) |
---|
-
src/wp-includes/class-wp-image-editor-imagick.php
154 154 return new WP_Error( 'invalid_image', __( 'File is not an image.' ), $this->file ); 155 155 } 156 156 157 if ( 'pdf' === $file_extension ) { 158 // When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped 159 // area (resulting in unnecessary whitespace) unless the following option is set. 160 $this->image->setOption( 'pdf:use-cropbox', true ); 161 } 162 157 163 // Select the first frame to handle animated images properly 158 164 if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) ) { 159 165 $this->image->setIteratorIndex( 0 ); … … 794 800 // We want the thumbnail to be readable, so increase the rendering DPI. 795 801 $this->image->setResolution( 128, 128 ); 796 802 797 // When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped798 // area (resulting in unnecessary whitespace) unless the following option is set.799 $this->image->setOption( 'pdf:use-cropbox', true );800 801 803 // Only load the first page. 802 804 return $this->file . '[0]'; 803 805 } catch ( Exception $e ) {