function image_style_flush

Flushes cached media for a style.

Parameters

$style: An image style array.

4 calls to image_style_flush()
ImageStyleStorageController::postDelete in drupal/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php
Overrides \Drupal\Core\Config\Entity\ConfigStorageController::postDelete().
ImageStyleStorageController::postSave in drupal/core/modules/image/lib/Drupal/image/ImageStyleStorageController.php
Overrides \Drupal\Core\Config\Entity\ConfigStorageController::postSave().
image_effect_delete in drupal/core/modules/image/image.module
Deletes an image effect.
image_effect_save in drupal/core/modules/image/image.module
Saves an image effect.

File

drupal/core/modules/image/image.module, line 696
Exposes global functionality for creating image styles.

Code

function image_style_flush($style) {

  // Delete the style directory in each registered wrapper.
  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE);
  foreach ($wrappers as $wrapper => $wrapper_data) {
    file_unmanaged_delete_recursive($wrapper . '://styles/' . $style
      ->id());
  }

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

  // 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('block')
      ->deleteAll();
  }
  cache('page')
    ->deleteAll();
}