Preserve alpha transparency when rotating a PNG while GD is the active image editor.
Adds unit tests. Props frankpw, voldemortensen. Fixes #30596. Built from https://develop.svn.wordpress.org/trunk@31040 git-svn-id: http://core.svn.wordpress.org/trunk@31021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e678f9d051
commit
de4d970d77
|
@ -306,9 +306,12 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||||
*/
|
*/
|
||||||
public function rotate( $angle ) {
|
public function rotate( $angle ) {
|
||||||
if ( function_exists('imagerotate') ) {
|
if ( function_exists('imagerotate') ) {
|
||||||
$rotated = imagerotate( $this->image, $angle, 0 );
|
$transparency = imagecolorallocatealpha( $this->image, 255, 255, 255, 127 );
|
||||||
|
$rotated = imagerotate( $this->image, $angle, $transparency );
|
||||||
|
|
||||||
if ( is_resource( $rotated ) ) {
|
if ( is_resource( $rotated ) ) {
|
||||||
|
imagealphablending( $rotated, true );
|
||||||
|
imagesavealpha( $rotated, true );
|
||||||
imagedestroy( $this->image );
|
imagedestroy( $this->image );
|
||||||
$this->image = $rotated;
|
$this->image = $rotated;
|
||||||
$this->update_size();
|
$this->update_size();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-alpha-31039';
|
$wp_version = '4.2-alpha-31040';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue