[Last Call] Learn how to a build a cloud-first strategyRegister Now


Thumbnails in Magento Commerce, variable height?

Posted on 2010-01-05
Medium Priority
Last Modified: 2013-11-18
Vendors don't always have their photos in the same format..

When I upload a photo that's 135px width , but not 135px height, for example lets say it's 135px wide by 110px high, magento will actually fill in the other 25px of vertical space with white.. The actual picture will have a new size of 135px by 135px after the image is imported.

Is this a setting I can change? Is there a downside to messing with this feature?

I wanted to have a nice looking background, but it looks really cheezy when my pictures have filler space.

I'm am importing the pictures via a csv file.

LVL 17

Expert Comment

ID: 26185606
You can have a PHP script to use ImageMagik to resize all images to size you want. You can do that as soon as people upload or you can write a PHP script which you can give a PHP directory as a parameter and it will convert all images in that folder to size you need. You need to send these type of questions in PHP section.
LVL 12

Accepted Solution

miked2004 earned 2000 total points
ID: 26190534
Magento will take the images you upload and resize them according to information in you template files.
If you images are not square just adjust the code in the template file to resize how you would like it. The code snippet attached is from /app/design/frontend/default/default/template/catalog/product/list.phtml.

If you change "resize(135, 135)" to what ever you want your images to be, when Magento creates its image cache it will create what ever size you enter here.

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="100" height="100" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />

Open in new window


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question