0

We are having issues with the Upselling Slider. This is the code I use to get the product thumbnails:

<?php $_imagehelper = $this->helper('Magento\Catalog\Helper\Image'); ?>
<?php $productImage = $_imagehelper->init($_item, 'category_page_grid')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(TRUE);
$productImageUrl = $productImage->getUrl(); 
echo "<!-- " . $productImageUrl . "-->"; ?>
<img src="<?php echo $productImageUrl; ?>" class="img-responsive" />

This is the result we get:

Blurry image

The Default code in the items.phtml is:

 <?php echo $block->getImage($_item, $image)->toHtml(); ?>

which gives us the same result (I'd say), so I does not depend on the code, as far as I understand this.

How can I load "full" thumbnail images? I understand that this will increase loading times, but the customer wishes to get non-blurry images, which is understandable.

0

I fixed it by declaring a new value in the etc/view.xml and further use it as $image's value.

        <image id="slider_image_grid" type="image">
            <width>595</width>
            <height>842</height>
        </image>

and PHP:

<?php $productImage = $_imagehelper->init($_item, 'slider_image_grid')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(TRUE); ?>

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.