Search code examples
magentomagento-1.9

How to resize the categories images in Magento?


How to resize the categories images in Magento? I used the following code to resize product images, but I'm not able to use it for showing categories images:

$this->helper('catalog/image')->init($_product, 'small_image')->resize(170);

Solution

  • If I am not mistaken, it should be :

    init($_product, 'small_image')->resize(100,100);
    
    // single parameter work with 'image'
    init($_product, 'image')->resize(100);
    
    // How about this
    $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $image->getFile())->resize(100,100);
    

    Here is the new code. If you tell me before which extension used, we were solve quickly. If I am not mistaken, you used Template Monster Catalog Image Extension. So, there is a function inside of the extension, like below.

    // app/design/frontend/default/default/template/easycatalogimg/homepage.phtml
    <?php echo Mage::helper('easycatalogimg/image')->resize($imageUrl, $width , $height) ?>