Skip to content

Commit f402686

Browse files
Merge pull request #1 from craig-bartlett/issue-35535-cast-floats-to-ints
magento#35535: Magento 2.4.4 Mini cart item images not showing
2 parents 5a022f6 + 5131a55 commit f402686

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ private function createWatermarkBasedOnPosition(
538538
} elseif ($this->getWatermarkPosition() == self::POSITION_STRETCH) {
539539
$watermark = $this->createWaterMark($watermark, $this->_imageSrcWidth, $this->_imageSrcHeight);
540540
} elseif ($this->getWatermarkPosition() == self::POSITION_CENTER) {
541-
$positionX = $this->_imageSrcWidth / 2 - imagesx($watermark) / 2;
542-
$positionY = $this->_imageSrcHeight / 2 - imagesy($watermark) / 2;
541+
$positionX = (int) ($this->_imageSrcWidth / 2 - imagesx($watermark) / 2);
542+
$positionY = (int) ($this->_imageSrcHeight / 2 - imagesy($watermark) / 2);
543543
$this->imagecopymergeWithAlphaFix(
544544
$this->_imageHandler,
545545
$watermark,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
334334
$watermark->sampleImage($this->_imageSrcWidth, $this->_imageSrcHeight);
335335
break;
336336
case self::POSITION_CENTER:
337-
$positionX = ($this->_imageSrcWidth - $watermark->getImageWidth()) / 2;
338-
$positionY = ($this->_imageSrcHeight - $watermark->getImageHeight()) / 2;
337+
$positionX = (int) (($this->_imageSrcWidth - $watermark->getImageWidth()) / 2);
338+
$positionY = (int) (($this->_imageSrcHeight - $watermark->getImageHeight()) / 2);
339339
break;
340340
case self::POSITION_TOP_RIGHT:
341341
$positionX = $this->_imageSrcWidth - $watermark->getImageWidth();

0 commit comments

Comments
 (0)