You are here

function andromeda_slideshow_delete_image in Andromeda Slideshow 7.2

Same name and namespace in other branches
  1. 7 andromeda_slideshow.module \andromeda_slideshow_delete_image()

Deletes an image from the database

Parameters

$image: the image object

1 call to andromeda_slideshow_delete_image()
andromeda_slideshow_image_delete_form_submit in includes/andromeda_slideshow.forms.inc
Submit handler for andromeda_slideshow_image_delete_form

File

./andromeda_slideshow.module, line 508
Slideshow for the Andromeda (http://drupal.org/project/andromeda) Theme

Code

function andromeda_slideshow_delete_image($image) {

  //delete the entry in the slideshow_images table
  $result = db_delete('slideshows_images')
    ->condition('siid', $image->siid)
    ->execute();

  //delete the entry in the file_managed table
  if ($result) {
    $file = file_load($image->fid);
    file_usage_delete($file, 'andromeda_slideshow', NULL, $image->siid, 0);
    if (file_delete($file)) {
      return TRUE;
    }
  }
  return FALSE;
}