1

I added swatch images for my brand. Swatch view

I get swatch data in my template:

$swatchData = $block->getSwatchData();

Next step - I show image inside my template:

$swatchThumbPath = $block->getSwatchPath('swatch_thumb',
                        $swatchData['swatches'][$option]['value']); ?>
<img src="<?=$swatchThumbPath?>" alt="<?= /* @escapeNotVerified */ $label['label'] ?>">

But on page I have compressed picture 110x78 pixels:

enter image description here

How can I get full-sized picture from swatch data?

2

You can try using swatch_image

 $swatchImagePath = $block->getSwatchPath('swatch_image',
                        $swatchData['swatches'][$option]['value']);
1
  • 1
    I just delete 'swatch_thumb' block, and it works.
    – Ashen One
    May 8 '19 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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