Changeset 39303
- Timestamp:
- 11/18/2016 10:21:19 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-image-editor-imagick.php
r39187 r39303 150 150 $filename = $this->file; 151 151 152 // By default, PDFs are rendered in a very low resolution.153 // We want the thumbnail to be readable, so increase the rendering dpi.154 152 if ( 'pdf' == strtolower( $file_parts['extension'] ) ) { 155 $this->image->setResolution( 128, 128 ); 156 157 // Only load the first page. 158 $filename .= '[0]'; 153 $filename = $this->pdf_setup(); 159 154 } 160 155 … … 744 739 } 745 740 741 /** 742 * Sets up Imagick for PDF processing. 743 * Increases rendering DPI and only loads first page. 744 * 745 * @since 4.7.0 746 * @access protected 747 * 748 * @return string|WP_Error File to load or WP_Error on failure. 749 */ 750 protected function pdf_setup() { 751 try { 752 // By default, PDFs are rendered in a very low resolution. 753 // We want the thumbnail to be readable, so increase the rendering DPI. 754 $this->image->setResolution( 128, 128 ); 755 756 // Only load the first page. 757 return $this->file . '[0]'; 758 } 759 catch ( Exception $e ) { 760 return new WP_Error( 'pdf_setup_failed', $e->getMessage(), $this->file ); 761 } 762 } 763 746 764 }
Note: See TracChangeset
for help on using the changeset viewer.