Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

resize() not working when getFile() is called
 
hschillig
Jr. Member
 
Total Posts:  15
Joined:  2013-07-10
 

Ok I’m in the media.phtml file trying to implement a slideshow, so for the big images, I’m doing a loop and the small thumbnails, I’m doing a similar loop.

Here is the loop for my big images:

<ul class="rslides" id="product-slider">
        
<?php foreach ($this->getGalleryImages() as $_image): ?>
        
<li>
                <
a href="#"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image', $_image->getFile())->resize(300); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
        </
li>
        
<?php endforeach; ?>
</ul>

However, resize() will not work no matter what I do. The image is way too big and I want to scale it down. But when I get rid of $_image->getFile() parameter, it resizes perfectly fine. However, only the first image will show and none of the others will when they are going through the slideshow. I have to keep that parameter in the init() function for the slideshow to work, but it won’t resize with it.

Can anyone help with this?

UGH NEVERMIND. Sorry for the confusion. Didn’t realize Responsive Slides JS was adding { width: 100%; } to the img tag!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top