You are here

function andromeda_slideshow_save_image in Andromeda Slideshow 7.2

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

Saves an image to the database

Parameters

$image: the image object

1 call to andromeda_slideshow_save_image()
andromeda_slideshow_image_form_submit in includes/andromeda_slideshow.forms.inc
Submit handler for andromeda_slideshow_image_form

File

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

Code

function andromeda_slideshow_save_image($image) {
  $fields = array(
    'fid' => $image->fid,
    'title' => $image->title,
    'caption' => $image->caption,
    'settings' => drupal_json_encode($image->settings),
  );
  if (empty($image->siid)) {
    $siid = db_insert('slideshows_images')
      ->fields($fields)
      ->execute();
  }
  else {
    $siid = db_update('slideshows_images')
      ->fields($fields)
      ->condition('siid', $image->siid)
      ->execute();
  }
  if ($siid) {
    $image->siid = $siid;
  }
  return $image;
}