You are here

function imagepicker_image_select in Image Picker 5

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_image_select()
  2. 6.2 imagepicker.functions.inc \imagepicker_image_select()
  3. 7 imagepicker.functions.inc \imagepicker_image_select()
1 call to imagepicker_image_select()
imagepicker_browse in ./imagepicker.module

File

./imagepicker.module, line 462
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_image_select() {
  global $user;
  $img = _imagepicker_get_img(arg(2));
  if ($img) {
    drupal_add_js(imagepicker_js($img), 'inline');
    $imgpath = imagepicker_get_image_path($img, 'browser');
    $content = '<div class="imgp_help">' . t('Choose the settings you want, place the cursor in the Body box above and Insert image.') . '</div>';
    if ($img['img_title']) {
      $content .= '<div id="imgp_img_holder_title">' . check_plain($img['img_title']) . '</div>';
    }
    if ($img['img_description']) {
      $content .= '<div id="imgp_img_holder_description">' . $img['img_description'] . '</div>';
    }
    $content .= '<div id="imgp_img_holder">';
    $content .= '<img id="imgp_img" src="' . $imgpath . '" alt="' . check_plain($img['img_title']) . '" title="' . $img['img_name'] . '" />';
    $content .= '</div>';
    $content .= drupal_get_form('imagepicker_image_form');

    // groups
    if (imagepicker_get_groups()) {
      $content .= drupal_get_form('imagepicker_group_images_form', $img['img_id']);
    }
  }
  else {
    drupal_set_message(t('Image not found.'), 'error');
    $content = '';
  }
  theme('imagepicker', $content);
}