image_style_flush

Versions
7
image_style_flush($style)

Flush cached media for a style.

Parameters

$style An image style array.

▾ 5 functions call image_style_flush()

image_default_style_revert in modules/image/image.module
Revert the changes made by users to a default image style.
image_effect_delete in modules/image/image.module
Delete an image effect.
image_effect_save in modules/image/image.module
Save an image effect.
image_style_delete in modules/image/image.module
Delete an image style.
image_style_save in modules/image/image.module
Save an image style.

Code

modules/image/image.module, line 689

<?php
function image_style_flush($style) {
  $style_directory = drupal_realpath(variable_get('file_default_scheme', 'public') . '://styles/' . $style['name']);
  if (is_dir($style_directory)) {
    file_unmanaged_delete_recursive($style_directory);
  }

  // Let other modules update as necessary on flush.
  module_invoke_all('image_style_flush', $style);

  // Clear image style and effect caches.
  cache_clear_all('image_styles', 'cache');
  cache_clear_all('image_effects', 'cache');
  drupal_static_reset('image_styles');
  drupal_static_reset('image_effects');

  // Clear field caches so that formatters may be added for this style.
  field_info_cache_clear();
  drupal_theme_rebuild();

  // Clear page caches when flushing.
  if (module_exists('block')) {
    cache_clear_all('*', 'cache_block', TRUE);
  }
  cache_clear_all('*', 'cache_page', TRUE);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.