You are here

function imagepicker_admin_view in Image Picker 5.2

Same name and namespace in other branches
  1. 6.2 imagepicker.admin.inc \imagepicker_admin_view()
1 call to imagepicker_admin_view()
imagepicker_admin_images in ./imagepicker.module

File

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

Code

function imagepicker_admin_view($img_id, $account = FALSE) {
  if ($account) {
    $user = $account;
    $userdir = array(
      'name' => $user->name,
      'uid' => $user->uid,
    );
  }
  else {
    global $user;
    $userdir = FALSE;
  }
  $img = _imagepicker_get_img($img_id, FALSE, $user);
  if ($img) {
    $imgpath = imagepicker_get_image_path($img, 'full', $userdir);
    $info = image_get_info(imagepicker_get_path(FALSE, $userdir) . $img['img_name']);
    $content = _imagepicker_view_content($img, $imgpath, $info) . drupal_get_form('imagepicker_admin_image_form', $img['img_id'], $user) . '<br />' . (_imagepicker_has_groups($user) ? drupal_get_form('imagepicker_group_images_form', $img['img_id'], $user) : '');
  }
  else {
    drupal_set_message(t('Image not found.'), 'error');
    $content = '';
  }
  return $content;
}