[wp-trac] [WordPress Trac] #46318: Black backgrounds in PDF thumbnails

WordPress Trac noreply at wordpress.org
Fri Feb 22 13:19:16 UTC 2019


#46318: Black backgrounds in PDF thumbnails
--------------------------+-----------------------------
 Reporter:  rdiazg        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.1
 Severity:  normal        |   Keywords:  has-screenshots
  Focuses:                |
--------------------------+-----------------------------
 When an user upload some pdfs which contain alpha layers to the media
 library, the thumbnail preview appears with a unwanted black background.
 Imagemagick's functions "class-wp-image-editor-imagick.php" not support
 hooks or filters to fix this behaviour. For testing purposes I was trying
 fix this with some code like:

 {{{#!php
 <?php
             if ( 'pdf' == $file_extension ) {
 $this->image->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
 $this->image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
             }
 }}}


 in

 https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-
 image-editor-imagick.php#L156

 And it's works for me but I don't know how this change affect to the
 others wordpress features that call this method. Could someone have a look
 at this?

 Thanks in advance.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46318>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list