6

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?

  • 2
    If the intention is to resize image files used in layout, the Google Pagespeed Apache/Nginx plugin will do that automagically for you. developers.google.com/speed/pagespeed/module/… – philwinkle Aug 15 '13 at 22:16
  • Hm that's nice, Ill look into that for my own server. However it's on an Apache (server) level and I do not always have access to that for every shop I build. I'm looking for a solution that is easy to implement without changing server configuration – Sander Mangel Aug 15 '13 at 22:26
8

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" />
  • By @Patos: Nice work. How do you use it or call it? – Fabian Blechschmidt Mar 6 '14 at 21:27
  • Bump...I would also like to use it could you add an example here :) – David Manners Jun 26 '14 at 11:49
  • Your extension is not available any more? – Simon Jan 21 '16 at 9:17
  • @Simon ah had some issues with that module regarding feedback on it so removed it. I can look for a copy this weekend if thats ok? – Sander Mangel Jan 21 '16 at 9:53
  • Thanks Sander, not sure if I will use it, but would be cool in any case since it is linked here :) – Simon Jan 21 '16 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.