I've created a Magento module which should hook into an event when a file is saved to cache. But it looks like there isn't any event like that, or am I missing something?

I currently hooked up with the


but then the file is edited by magento before writing to cache because it's resized. Therefor overwriting my file optimalisation.

Is there any way I can hook to an image before it's written to cache, or after the resizing?


There is no native function or event for this.

But you can done by rewrite the image save function Mage_Catalog_Model_Product_Image::save file()


public function saveFile() { 
   $filename = $this->getNewFile();
   //you can do your logic here.
    return $this; 
| improve this answer | |
  • That is the place when it's saved to the cache? – Niels Aug 2 '15 at 11:55
  • Yes, to resize product image we have use following code Mage::helper('catalog/image')->init($product,'image')->resize(500). So in this function they have save the image using above function. – MeenakshiSundaram R Aug 2 '15 at 13:03

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.