Magento – Observer (event hook) for media or images

cdnevent-observerimagemedia

I want to create a module that will hook events for images being added to products or vendors etc so that when it's saved and was already an existing image (image was being updated) – that it would invalidate that image (in cloudfront).

What events would allow me to detect this; maybe extend the image.php where it saves the image? Currently I don't see any dispatched events that will help me;

I tried: core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php:277:

Mage::dispatchEvent('catalog_product_media_add_image', array('product' => $product, 'image' => $file));

But found that the event is not dispatched when adding an image to a product. But technically – I only need to know about changed images – is there a way for me to detect (by hooking the before or after product save event) what properties have been updated?

Any direction would be greatly appreciated.

Best Answer

Try the event catalog_product_gallery_upload_image_after this should be fired on the upload action of the controller Mage_Adminhtml_Catalog_Product_GalleryController from your question I think this is the right event for you.

Related Topic