You are here

function node_gallery_delete_image in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.inc \node_gallery_delete_image()
1 call to node_gallery_delete_image()
_node_gallery_delete in ./node_gallery.module
Implementation of hook_nodeapi(op='delete').

File

./node_gallery.inc, line 282
Node gallery models

Code

function node_gallery_delete_image($node) {

  //Clean up our tables
  db_query("DELETE FROM {node_galleries} WHERE nid = %d", $node->nid);
  db_query("DELETE FROM {files} WHERE fid = %d", $node->fid);

  //Delete the file from the filesystem
  file_delete($node->filepath);

  //Clean our imagecache - note, this API call leaves empty dirs
  imagecache_image_flush($node->filepath);

  //Clean up empty dirs, if they exist
  node_gallery_clean_empty_dirs(dirname($node->filepath));
}