You are here

function _itweak_upload_files_imagecache_flush in iTweak Upload 6.2

Take care of imagecache when files are uploaded or deleted.

1 string reference to '_itweak_upload_files_imagecache_flush'
itweak_upload_form_alter in ./itweak_upload.module
Implementation of hook_form_alter().

File

./itweak_upload.module, line 1346
iTweakUpload - Tweak attachments display and file upload forms.

Code

function _itweak_upload_files_imagecache_flush(&$form, &$form_state) {
  if (function_exists('imagecache_file_delete') && isset($form_state['values']['files'])) {
    foreach ($form_state['values']['files'] as $fid => $file) {

      // Instead of figuring out if file has other references, been replaced
      // or why else it should not be flushed form imagecache,
      // we purge the cache regardless.
      // Imagecache will rebuild it when needed if there are other references.
      imagecache_file_delete((object) $file);
    }
  }
}