You are here

function imagepicker_insert_image in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.functions.inc \imagepicker_insert_image()

Function to insert the image data into db

Parameters

$uid: Required user id

$img_name: Required image name

$img_title: Optional image title

$img_description: Optional image description

Return value

Returns the current img id

3 calls to imagepicker_insert_image()
imagepicker_copy_form_submit in ./imagepicker.functions.inc
Function to submit the copy form
imagepicker_import_batch in ./imagepicker.import.inc
imagepicker_upload_form_submit in ./imagepicker.upload.inc
Submit form

File

./imagepicker.functions.inc, line 2878
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_insert_image($uid, $img_name, $img_title = "", $img_description = "") {
  if (!$uid || !$img_name) {
    return FALSE;
  }
  if (drupal_strlen($img_description) > 254) {
    $img_description = drupal_substr($img_description, 0, 254);
  }
  $nextimgid = db_insert('imagepicker')
    ->fields(array(
    'uid' => $uid,
    'img_name' => $img_name,
    'img_title' => check_plain($img_title),
    'img_description' => check_plain($img_description),
    'img_date' => time(),
  ))
    ->execute();
  return $nextimgid;
}