You are here

function imagecache_customactions_image_style_flush in ImageCache Actions 7

Same name and namespace in other branches
  1. 8 customactions/imagecache_customactions.module \imagecache_customactions_image_style_flush()

Implements hook_image_style_flush().

This hook checks if the image style that is being flushed is used in a subroutine effect. If so, the style that contains the subroutine effect should be flushed as well.

This may lead to recursive calls to image_style_flush() and thus to this hook. Without loops in styles that call each other as subroutine, this recursion will always end.

Parameters

array $flushed_style: The image style that is being flushed.

File

customactions/imagecache_customactions.module, line 79
Allows advanced users to code their own PHP image manipulation routines as part of image style processing.

Code

function imagecache_customactions_image_style_flush($flushed_style) {
  $styles = image_styles();
  foreach ($styles as $style) {
    if ($style['name'] !== $flushed_style['name']) {
      foreach ($style['effects'] as $effect) {
        if ($effect['name'] === 'imagecache_subroutine') {
          if (isset($effect['data']['subroutine_presetname']) && $effect['data']['subroutine_presetname'] === $flushed_style['name']) {
            image_style_flush($style);
          }
        }
      }
    }
  }
}