Same name and namespace in other branches
  1. 10 core/modules/image/image.module \image_path_flush()
  2. 8.9.x core/modules/image/image.module \image_path_flush()
  3. 9 core/modules/image/image.module \image_path_flush()

Clears cached versions of a specific file in all styles.

Parameters

$path: The Drupal file path to the original image.

2 calls to image_path_flush()
image_file_delete in modules/image/image.module
Implements hook_file_delete().
image_file_move in modules/image/image.module
Implements hook_file_move().

File

modules/image/image.module, line 548
Exposes global functionality for creating image styles.

Code

function image_path_flush($path) {
  $styles = image_styles();
  foreach ($styles as $style) {
    $image_path = image_style_path($style['name'], $path);
    if (file_exists($image_path)) {
      file_unmanaged_delete($image_path);
    }
  }
}