You are here

function image_delete in Image 5

Same name and namespace in other branches
  1. 5.2 image.module \image_delete()
  2. 6 image.module \image_delete()

Implementation of hook_delete.

File

./image.module, line 734

Code

function image_delete($node) {
  $result = db_query('SELECT fid, filepath FROM {files} WHERE nid = %d', $node->nid);
  while ($file = db_fetch_object($result)) {
    file_delete(file_create_path($file->filepath));
    db_query("DELETE FROM {file_revisions} WHERE fid = %d", $file->fid);
  }
  db_query('DELETE FROM {files} WHERE nid = %d', $node->nid);
}