You are here

function _imagefield_file_delete in ImageField 5.2

Same name and namespace in other branches
  1. 5 imagefield.module \_imagefield_file_delete()
2 calls to _imagefield_file_delete()
imagefield_field in ./imagefield.module
Implementation of hook_field().
imagefield_file_update in ./imagefield.module
Update the file record if necessary.

File

./imagefield.module, line 554
Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

function _imagefield_file_delete($file, $fieldname) {
  if (is_numeric($file['fid'])) {
    db_query('DELETE FROM {files} WHERE fid = %d', $file['fid']);
  }
  else {
    unset($_SESSION['imagefield'][$fieldname][$file['sessionid']]);
  }
  module_invoke_all('imagefield_file', 'delete', $file);
  return file_delete($file['filepath']);
}