Magento – Resizing any image in Magento

imagemagento-1.7

Magento has this great helper to resize product images but I'd like to resize any image from PHTML template files.

Now I could use the Varien_Image (lib/Varien/Image) class but it doesn't implement caching which is in my opinion required for resizing.

Is there an extension you can recommend for this or any other solution or should I build my own?

Best Answer

I wasn't able to find a solution in the form of an extension so build my own which you can download on github.

@Philwinkle's suggestion to use Googles Mod Pagespeed would have been easier but unfortunately in the case it was not possible to modify the server configuration.

Usage

<img src="<?php echo $this->helper('rkimages/image')->run('path/to/your/image')->resize(135); ?>" alt="Your Alt Here" />