Skip to content

Commit 0a5208e

Browse files
ENGCOM-2956: [Forwardport] Fixes black background for png images in wysiwyg editors. #17857
2 parents c608c9f + a265266 commit 0a5208e

File tree

1 file changed

+13
-0
lines changed
  • lib/internal/Magento/Framework/Image/Adapter

1 file changed

+13
-0
lines changed

lib/internal/Magento/Framework/Image/Adapter/Gd2.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Framework\Image\Adapter;
77

8+
/**
9+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
10+
*/
811
class Gd2 extends \Magento\Framework\Image\Adapter\AbstractAdapter
912
{
1013
/**
@@ -66,6 +69,16 @@ public function open($filename)
6669
$this->_getCallback('create', null, sprintf('Unsupported image format. File: %s', $this->_fileName)),
6770
$this->_fileName
6871
);
72+
$fileType = $this->getImageType();
73+
if (in_array($fileType, [IMAGETYPE_PNG, IMAGETYPE_GIF])) {
74+
$this->_keepTransparency = true;
75+
if ($this->_imageHandler) {
76+
$isAlpha = $this->checkAlpha($this->_fileName);
77+
if ($isAlpha) {
78+
$this->_fillBackgroundColor($this->_imageHandler);
79+
}
80+
}
81+
}
6982
}
7083

7184
/**

0 commit comments

Comments
 (0)