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
  • 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, 2013 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 Aug 15, 2013 at 22:26

1 Answer 1

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" />
6
  • By @Patos: Nice work. How do you use it or call it? Mar 6, 2014 at 21:27
  • Bump...I would also like to use it could you add an example here :) Jun 26, 2014 at 11:49
  • Your extension is not available any more?
    – Simon
    Jan 21, 2016 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? Jan 21, 2016 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, 2016 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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