You are here

function imagepicker_image_select in Image Picker 6.2

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_image_select()
  2. 5 imagepicker.module \imagepicker_image_select()
  3. 7 imagepicker.functions.inc \imagepicker_image_select()
2 calls to imagepicker_image_select()
imagepicker_browse in ./imagepicker.functions.inc
Menu local task; presents the browse and select pages for imagepicker
imagepicker_browse_public in ./imagepicker.functions.inc

File

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

Code

function imagepicker_image_select($img_id, $showgroup = TRUE, $public = FALSE, $account = FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $img = _imagepicker_get_img($img_id, $public ? FALSE : TRUE);
  if ($img) {
    $form1 = '';
    if ($user->uid == $img['uid'] || $public) {
      $form1 = drupal_get_form('imagepicker_image_form', $img['img_id'], $public);
    }

    // groups
    $form2 = '';
    if (_imagepicker_has_groups() && $showgroup) {
      $form2 = drupal_get_form('imagepicker_group_images_form', $img['img_id']);
    }
    $content = theme('imagepicker_insert', $img, $public, $form1, $form2);
  }
  else {
    drupal_set_message(t('Image not found.'), 'error');
    $content = '';
  }
  return theme('imagepicker_iframe', $content, $img, $public);
}