Thumbnails in Magento Commerce, variable height?

Posted on 2010-01-05
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

    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

    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

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    I recently read an article which suggested that 60% of businesses in the U.S. that process credit card details online in order to accept payment for goods or services were not Payment Card Industry security standards (PCI) compliant. This statement …
    SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now