Skip to content

Commit e922874

Browse files
committed
Merge remote-tracking branch 'origin/MC-30320' into 2.4-develop-pr10
2 parents f120047 + 305f573 commit e922874

File tree

1 file changed

+16
-3
lines changed
  • lib/internal/Magento/Framework/Image/Adapter

1 file changed

+16
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,9 @@ protected function _createEmptyImage($width, $height)
822822
* @param int $src_w
823823
* @param int $src_h
824824
* @param int $pct
825-
*
826825
* @return bool
826+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
827+
* @SuppressWarnings(PHPMD.NPathComplexity)
827828
*/
828829
private function imagecopymergeWithAlphaFix(
829830
$dst_im,
@@ -859,12 +860,24 @@ private function imagecopymergeWithAlphaFix(
859860
return false;
860861
}
861862

863+
if (false === imagesavealpha($tmpImg, true)) {
864+
return false;
865+
}
866+
862867
if (false === imagecopy($tmpImg, $src_im, 0, 0, 0, 0, $sizeX, $sizeY)) {
863868
return false;
864869
}
865870

866-
$transparancy = 127 - (($pct*127)/100);
867-
if (false === imagefilter($tmpImg, IMG_FILTER_COLORIZE, 0, 0, 0, $transparancy)) {
871+
$transparency = 127 - (($pct*127)/100);
872+
if (false === imagefilter($tmpImg, IMG_FILTER_COLORIZE, 0, 0, 0, $transparency)) {
873+
return false;
874+
}
875+
876+
if (false === imagealphablending($dst_im, true)) {
877+
return false;
878+
}
879+
880+
if (false === imagesavealpha($dst_im, true)) {
868881
return false;
869882
}
870883

0 commit comments

Comments
 (0)