• Magento

    Change Magento Default Image Size - Resize

    Posted on June 12th, 2010

    Written by CJ

    Tags

    How to Change Magento Image Default Size.

    Magento’s default image size for it’s product page is 300px X 300px or 265px x 265px. And let’s say you want to change it to 320×420.

    In this example I will change the modern theme default image size of 300px, which can be applied to the standard default (265px) or your custom theme default image size.

    Step 1:

    Navigate and open:
    \magentostore\app\design\frontend\default\default\template\catalog\product\view\media.phtml

    Change

        <?php
            $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(300).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'"/>';
            echo $_helper->productAttribute($_product, $_img, 'image');
        ?>

    To

        <?php
            $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(320,420).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'"/>';
            echo $_helper->productAttribute($_product, $_img, 'image');
        ?>

    Step 2:

    Navigate and open:
    \magentostore\skin\frontend\default\default\css\boxes.css

    Change
    .product-img-box { float:left; width:302px; }
    To
    .product-img-box { float:left; width:322px; }
    Change
    .product-img-box .product-image-zoom { position:relative; overflow:hidden; width:300px; height:300px; z-index:9; border:1px solid #cacaca; }
    To
    .product-img-box .product-image-zoom { position:relative; overflow:hidden; width:320px; height:420px; z-index:9; border:1px solid #cacaca; }
    Change
    .product-info-box               { float:right; width:363px; }
    To
    .product-info-box               { float:right; width:343px; }

    Step 3:

    Refresh Cache and Clear Image Cache



    This entry was posted on Saturday, June 12th, 2010 at 10:06 pm and is filed under Magento. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.
  • 2 Comments

    Take a look at some of the responses we've had to this article.

    1. " Change Magento Default Image Size - Resize "

      Posted on August 17th

      I can’t seem to get this to work!

    2. " Change Magento Default Image Size - Resize "

      sellonline
      Posted on October 30th

      ir works but in my case the code that you say was in the boxes.css was in the styles.css because i am using a template that I bought…

  • Post a Comment

    Let us know what you thought.

  • Name:

    Email:

    Website:

    Message: