You are here

function _image_file_remove in Image 6

Remove image file if no other node references it.

Parameters

$file: An object representing a table row from {files}.

2 calls to _image_file_remove()
image_delete in ./image.module
Implementation of hook_delete().
image_update in ./image.module
Implementation of hook_update().

File

./image.module, line 1031

Code

function _image_file_remove($file) {
  if (!db_result(db_query("SELECT COUNT(*) FROM {image} WHERE fid = %d", $file->fid))) {
    file_delete(file_create_path($file->filepath));
    db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);
  }
}