You are here

function imagecache_canvasactions_image_style_flush in ImageCache Actions 8

Same name and namespace in other branches
  1. 7 canvasactions/imagecache_canvasactions.module \imagecache_canvasactions_image_style_flush()

Implements hook_image_style_flush().

This hook checks if the image style that is being flushed is used in an aspect switcher effect. If so, the style that contains the aspect switcher effect, should be flushed as well as the flushed style was probably changed.

Parameters

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

File

canvasactions/imagecache_canvasactions.module, line 207

Code

function imagecache_canvasactions_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'] === 'canvasactions_aspect') {
          if (isset($effect['data']['portrait']) && $effect['data']['portrait'] === $flushed_style['name'] || isset($effect['data']['landscape']) && $effect['data']['landscape'] === $flushed_style['name']) {
            image_style_flush($style);
          }
        }
      }
    }
  }
}