Make WordPress Core

Changeset 56271

Timestamp:
07/19/2023 10:33:47 PM (12 months ago)
Author:
antpb
Message:

Media: Adjust PDF upload handling to remove non-opaque alpha channels from previews.

Previously, Imagick uploads of PDF files with non-opaque alpha channels would result in a black background replacing alpha in the generated thumbnail. This patch adds a remove_pdf_alpha_channel() function in the Imagick classes to use a white background instead.

Props gitlost, joemcgill, joedolson, launchinteractive, emirpprime, mwtsn, ceer, maysi, madejackson, 6adminit, costdev, oglekler.
Fixes #39216.

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r56250 r56271  
    169169            }
    170170
     171
     172
     173
     174
    171175            $this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
    172176        } catch ( Exception $e ) {
     
    753757
    754758    /**
     759
     760
     761
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
    755777     * @since 3.5.0
    756778     * @since 6.0.0 The `$filesize` value was added to the returned array.
  • trunk/tests/phpunit/tests/image/editorImagick.php

    r54401 r56271  
    642642        $this->assertNotWPError( $saved );
    643643    }
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
    644694}
Note: See TracChangeset for help on using the changeset viewer.