Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#46318 closed defect (bug) (duplicate)

Black backgrounds in PDF thumbnails

Reported by: rdiazg's profile rdiazg Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.1
Component: Media Keywords: has-screenshots
Focuses: Cc:

Description

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
            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.

Attachments (1)

PDF_BLACK_BACKGROUND.png (13.6 KB) - added by rdiazg 6 years ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there and welcome to Trac!

It looks like we are already tracking this in #45982. Let's discuss possible solutions there.

#2 @rdiazg
6 years ago

Sure, thanks for your quick reply :)

Note: See TracTickets for help on using tickets.