You are here

function imagepicker_user_view in Image Picker 5

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_user_view()
  2. 6.2 imagepicker.user.inc \imagepicker_user_view()
1 call to imagepicker_user_view()
imagepicker_user_page in ./imagepicker.module

File

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

Code

function imagepicker_user_view($img_id) {
  $img = _imagepicker_get_img($img_id);
  if ($img) {
    $imgpath = imagepicker_get_image_path($img, 'full');
    $content .= '<div id="imgp_img_view">';
    if ($img['img_title']) {
      $content .= '<div id="imgp_img_view_title">' . $img['img_title'] . '</div>';
    }
    $content .= '<img id="imgp_img_view_img" src="' . $imgpath . '" alt="' . $img['img_title'] . '" title="' . $img['img_name'] . '" />';
    if ($img['img_description']) {
      $content .= '<div id="imgp_img_view_desc">' . nl2br($img['img_description']) . '</div>';
    }
    $imgbasedir = imagepicker_get_path(FALSE, TRUE);
    $file = $imgbasedir . $img['img_name'];
    $info = image_get_info($file);
    $content .= "<div>";
    $content .= t('Width') . ": " . $info['width'] . "&nbsp;&nbsp;&nbsp;";
    $content .= t('Height') . ": " . $info['height'] . "&nbsp;&nbsp;&nbsp;";
    $content .= t('Type') . ": " . $info['extension'] . "&nbsp;&nbsp;&nbsp;";
    $content .= t('Size') . ": " . $info['file_size'];
    $content .= "</div>";
    $content .= '</div>';
    $content .= drupal_get_form('imagepicker_user_image_form', $img);

    // 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 = '';
  }
  return $content;
}