function image_example_style_flush in Examples for Developers 7
Implements hook_image_style_flush().
This hook allows modules to respond when a style is being flushed. Styles are flushed any time a style is updated, an effect associated with the style is updated, a new effect is added to the style, or an existing effect is removed.
Flushing removes all images generated using this style from the host. Once a style has been flushed derivative images will need to be regenerated. New images will be generated automatically as needed but it is worth noting that on a busy site with lots of images this could have an impact on performance.
Note: This function does not currently have any effect as the example module does not use any caches. It is demonstrated here for completeness sake only.
Related topics
File
- image_example/
image_example.module, line 184 - Module file for image_example
Code
function image_example_style_flush($style) {
// Empty any caches populated by our module that could contain stale data
// after the style has been flushed. Stale data occurs because the module may
// have cached content with a reference to the derivative image which is
// being deleted.
cache_clear_all('*', 'image_example', TRUE);
}