Skip to content

Commit edaa158

Browse files
committed
ACP2E-1632: GIF Images issue on product page
1 parent 3218b12 commit edaa158

File tree

1 file changed

+6
-2
lines changed
  • lib/internal/Magento/Framework/Image/Adapter

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,12 @@ private function applyTransparency(&$imageResourceTo, $transparentIndex): void
344344
$transparentColor = false;
345345

346346
if ($transparentIndex >= 0 && $transparentIndex <= imagecolorstotal($this->_imageHandler)) {
347-
list($red, $green, $blue) = array_values(imagecolorsforindex($this->_imageHandler, $transparentIndex));
348-
$transparentColor = imagecolorallocate($imageResourceTo, (int) $red, (int) $green, (int) $blue);
347+
try {
348+
$colorsForIndex = imagecolorsforindex($this->_imageHandler, $transparentIndex);
349+
list($red, $green, $blue) = array_values($colorsForIndex);
350+
$transparentColor = imagecolorallocate($imageResourceTo, (int) $red, (int) $green, (int) $blue);
351+
} catch (\ValueError $e) {
352+
}
349353
}
350354
if (false === $transparentColor) {
351355
throw new \InvalidArgumentException('Failed to allocate transparent color for image.');

0 commit comments

Comments
 (0)