Media: Prevent unnecessary whitespace around PDF Thumbnails.

Stops unintended whitespace from showing around PDF thumbnails
when the PDF creation tool utilized a CropBox.

Props michelweimerskirch, joemcgill.
Fixes #45598.
Built from https://develop.svn.wordpress.org/trunk@46238


git-svn-id: http://core.svn.wordpress.org/trunk@46050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mike Schroder 2019-09-23 10:36:57 +00:00
parent 317ceae1ea
commit 69bb09df6e
2 changed files with 5 additions and 1 deletions

View File

@ -787,6 +787,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
// We want the thumbnail to be readable, so increase the rendering DPI.
$this->image->setResolution( 128, 128 );
// When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped
// area (resulting in unnecessary whitespace) unless the following option is set.
$this->image->setOption( 'pdf:use-cropbox', true );
// Only load the first page.
return $this->file . '[0]';
} catch ( Exception $e ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-46237';
$wp_version = '5.3-alpha-46238';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.