You are here

function _imagepicker_get_img in Image Picker 6.2

Same name and namespace in other branches
  1. 5.2 imagepicker.module \_imagepicker_get_img()
  2. 5 imagepicker.module \_imagepicker_get_img()
  3. 7 imagepicker.functions.inc \_imagepicker_get_img()
11 calls to _imagepicker_get_img()
imagepicker_admin_images in ./imagepicker.admin.inc
imagepicker_admin_view in ./imagepicker.admin.inc
imagepicker_copy_form_submit in ./imagepicker.functions.inc
Function to submit the copy form
imagepicker_copy_form_validate in ./imagepicker.functions.inc
Function to validate the copy form
imagepicker_image_select in ./imagepicker.functions.inc

... See full list

File

./imagepicker.functions.inc, line 1902
Imagepicker functions

Code

function _imagepicker_get_img($img_id, $checkuser = TRUE, $account = FALSE) {
  if (is_object($account)) {
    $user = $account;
  }
  else {
    global $user;
  }
  $result = db_query_range("SELECT * FROM {imagepicker} WHERE img_id = '%d'", $img_id, 0, 1);
  $img = db_fetch_array($result);
  if (count($img)) {
    if ($img['uid'] != $user->uid && $checkuser) {
      drupal_set_message(t('This image does not belong to you.'), 'error');
      watchdog('imagepicker', 'User uid %d attempted to edit image belonging to user uid %d', array(
        $user->uid,
        $img['uid'],
      ), WATCHDOG_WARNING);
      return FALSE;
    }
    return $img;
  }
  return FALSE;
}