You are here

function imageinfo_cache_file_delete in Imageinfo Cache 7.3

Same name and namespace in other branches
  1. 6.2 imageinfo_cache.module \imageinfo_cache_file_delete()
  2. 6 imageinfo_cache.module \imageinfo_cache_file_delete()

Implements hook_file_delete().

File

./imageinfo_cache.module, line 262
Imageinfo Cache module.

Code

function imageinfo_cache_file_delete($file) {
  if (empty($file->uri)) {
    return;
  }

  // Generate a list of cache ids from the uri.
  $image_styles = image_styles();
  $cids = array(
    'ORIGINAL-FILE:' . drupal_hash_base64($file->uri),
  );
  foreach ($image_styles as $style_name => $style_info) {
    $cids[] = $style_name . ':' . drupal_hash_base64(image_style_path($style_name, $file->uri));
  }

  // Clear the cache.
  cache_clear_all($cids, 'cache_imageinfo');
}