0

If I set only the "base" image watermark in the admin panel, it watermarks not only the fullscreen image but also the "medium" image used in the main product view. On the full image, the watermark is the correct size but on the medium image, the watermark covers about a third of the product image.

How can I either stop the medium image being watermarked or allow the watermark to be sized proportionally to the product image size? i.e. by setting a heightXwidth percentage instead of a pixel value.

Also, my watermark has a white background which gets converted to transparent - this is not desirable for me.

TIA.

1 Answer 1

1

There is a bug in Magento 2.2.5 related to transparency: https://github.com/magento/magento2/issues/16929

As a workaround you can create a patch or update to 2.2.7

diff --git a/Image/Adapter/Gd2.php b/Image/Adapter/Gd2.php
index 33d7376..e04ecc3 100644
--- a/Image/Adapter/Gd2.php
+++ b/Image/Adapter/Gd2.php
@@ -425,7 +425,6 @@ class Gd2 extends \Magento\Framework\Image\Adapter\AbstractAdapter
             $col = imagecolorallocate($newWatermark, 255, 255, 255);
             imagecolortransparent($newWatermark, $col);
             imagefilledrectangle($newWatermark, 0, 0, $this->getWatermarkWidth(), $this->getWatermarkHeight(), $col);
-            imagealphablending($newWatermark, true);
             imagesavealpha($newWatermark, true);
             imagecopyresampled(
                 $newWatermark,
@@ -450,7 +449,6 @@ class Gd2 extends \Magento\Framework\Image\Adapter\AbstractAdapter
             $col = imagecolorallocate($newWatermark, 255, 255, 255);
             imagecolortransparent($newWatermark, $col);
             imagefilledrectangle($newWatermark, 0, 0, $this->_imageSrcWidth, $this->_imageSrcHeight, $col);
-            imagealphablending($newWatermark, true);
             imagesavealpha($newWatermark, true);
             imagecopyresampled(
                 $newWatermark,
-- 
2.17.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.