You are here

public static function TextimageStyles::flush in Textimage 7.3

Flushes Textimage style data.

Clears immediate cache and all the image files associated.

Parameters

array $style: the style being flushed

1 call to TextimageStyles::flush()
textimage_image_style_flush in ./textimage.module
Implements hook_image_style_flush().

File

classes/TextimageStyles.inc, line 179
Textimage - Styles handling class.

Class

TextimageStyles
Styles management class.

Code

public static function flush($style) {
  cache_clear_all('tiid:', 'cache_textimage', TRUE);

  // Clear hashed filename images.
  if (file_exists(_textimage_get_store_path('styled_hashed/') . $style['name'])) {
    file_unmanaged_delete_recursive(_textimage_get_store_path('styled_hashed/') . $style['name']);
  }

  // Clear images, checking in all available schemes.
  foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $wrapper => $wrapper_data) {
    if (file_exists($wrapper . '://textimage/' . $style['name'])) {
      file_unmanaged_delete_recursive($wrapper . '://textimage/' . $style['name']);
    }
  }
}