cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 resizing carousel image

SOLVED

Magento 1.9 resizing carousel image

 

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 ?>

Original bannerOriginal banner

 

banner after set it as carousel bannerbanner after set it as carousel banner

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 1.9 resizing carousel image

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. 

Manish Mittal
https://www.manishmittal.com/

View solution in original post

4 REPLIES 4

Re: Magento 1.9 resizing carousel image

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. 

Manish Mittal
https://www.manishmittal.com/

Re: Magento 1.9 resizing carousel image

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

Re: Magento 1.9 resizing carousel image

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. 

Manish Mittal
https://www.manishmittal.com/

Re: Magento 1.9 resizing carousel image

Yes, I checked the variable

$_product

But if I just add one simple line the content disapear, the file its a slideshow.phml