You are here

function _img_assist_remove in Image Assist 5

Same name and namespace in other branches
  1. 5.3 img_assist.module \_img_assist_remove()
  2. 5.2 img_assist.module \_img_assist_remove()
  3. 6.2 img_assist.module \_img_assist_remove()
  4. 6 img_assist.module \_img_assist_remove()

Related topics

1 call to _img_assist_remove()
_img_assist_build_derivatives in ./img_assist.module
Generate a image derivative

File

./img_assist.module, line 1235
Image Assist module

Code

function _img_assist_remove($node, $size) {
  $result = db_query("SELECT * FROM {files} WHERE nid = %d AND filename = '%s'", $node->nid, $size['key']);
  while ($file = db_fetch_object($result)) {

    // Never delete original image.
    if ($file->filepath != $node->images[IMAGE_ORIGINAL]) {

      // Delete image file.
      file_delete(file_create_path($file->filepath));

      // Delete file reference in database.
      db_query("DELETE FROM {files} WHERE nid = %d AND filename = '%s'", $node->nid, $size['key']);
    }
  }
}