You are here

function _imagefield_file_delete in ImageField 5

Same name and namespace in other branches
  1. 5.2 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 352
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']]);
  }
  return file_delete($file['filepath']);
}