I bought the "codazon theme" and it has a banner carousel on the homepage, but whenever I put a new image it resizes and adds white frames.
I've seen on the internet teaching how to remove these frames only from product thumbs but not from carousel images.
I don't know what else to do, because regardless of image resolution, it's always resized.
The following code is the foreach responsible for the carousel images
<?php foreach ($slideItems as $itemData) : ?> <?php $item->setData($itemData); ?> <?php $image = $item->getData('image'); $image = str_replace($mediaUrl, '', $this->filter($image)); $image = $imgHelper->getImage($image, $width, $height); $desc = $item->getData('content'); ?> <div class="item"> <a class="item-image abs-img" style="height: <?= $paddingBottom ?>px" href="<?= $item->getData('link') ?>"> <img class="owl-lazy" data-src="<?= $image ?>" /> </a> <?php if ($desc) : ?> <div class="item-desc"> <?= $desc ?> </div> <?php endif ?> </div> <?php endforeach ?>
Solved! Go to Solution.
Hello @douglas_lima2
You can use below function if that can help:
$_imageUrl = $this->helper('catalog/image')
->init($_product, 'image', $_image->getFile())
->keepFrame(false)
->constrainOnly(true)
->resize(500);
Pass pixel value in resize.
Hello @douglas_lima2
You can use below function if that can help:
$_imageUrl = $this->helper('catalog/image')
->init($_product, 'image', $_image->getFile())
->keepFrame(false)
->constrainOnly(true)
->resize(500);
Pass pixel value in resize.
Hi @Manish Mittal, thanks for you reply... Well, I'm trying use your code like that...
<?php foreach ($slideItems as $itemData) : ?> <?php $item->setData($itemData); ?> <?php $image = $item->getData('image'); $image = str_replace($mediaUrl, '', $this->filter($image)); $image = $imgHelper->getImage($image, $width, $height); $_imageUrl = $imgHelper ->init($_product, 'image', $_image->getFile()) ->keepFrame(false) ->constrainOnly(true) ->resize(500); $desc = $item->getData('content'); ?> <div class="item"> <a class="item-image abs-img" style="padding-bottom: <?= $paddingBottom ?>px" href="<?= $item->getData('link') ?>"> <img class="owl-lazy" data-src="<?= $image ?>" /> </a> <?php if ($desc) : ?> <div class="item-desc"> <?= $desc ?> </div> <?php endif ?> </div> <?php endforeach ?>
I have the helper in a variable, but, if I introduce this line into the file, whole main content disapear, except the header... any suggestion? No error appears, just disapear the content. Weird
Hello @douglas_lima2
Please check variable
$_product
not exists in your code. I just share an example so do not copy as it is you can take it as a reference.
Yes, I checked the variable
$_product
But if I just add one simple line the content disapear, the file its a slideshow.phml