You are here

function imagepicker_image_select in Image Picker 7

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_image_select()
  2. 5 imagepicker.module \imagepicker_image_select()
  3. 6.2 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 34
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

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_id, $public);
    }

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