You are here

function imagepicker_adminview in Image Picker 7

1 call to imagepicker_adminview()
imagepicker_admin_images in ./imagepicker.admin.inc

File

./imagepicker.admin.inc, line 1040
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_adminview($img_id, $account = FALSE) {
  if ($account) {
    $user = $account;
    $userdir = array(
      'uid' => $user->uid,
    );
  }
  else {
    global $user;
    $userdir = FALSE;
  }
  $form1 = NULL;
  $form2 = NULL;
  $form3 = NULL;
  $imagepicker_jspaths = imagepicker_jspaths_get();
  drupal_add_js($imagepicker_jspaths['imagepicker_jspath']);
  $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);
    $exifinfo = "";
    if ($info['extension'] != 'gif') {
      $exifinfo = imagepicker_get_exifinfo(imagepicker_get_path(FALSE, $userdir) . $img->img_name);
    }
    $view = theme('imagepicker_view', array(
      'img' => $img,
      'imgpath' => $imgpath,
      'info' => $info,
      'exifinfo' => $exifinfo,
    ));
    $form1 = drupal_get_form('imagepicker_admin_image_form', $img_id, $user);

    // copy form
    if (imagepicker_variable_get('imagepicker_copy_enabled', 0)) {
      $form2 = drupal_get_form('imagepicker_copy_form', $img->img_id, $img->img_name, $user);
    }

    // group form
    if (_imagepicker_has_groups($user)) {
      $form3 = drupal_get_form('imagepicker_group_images_form', $img->img_id, $user);
    }
    $content = theme('imagepicker_adminview', array(
      'view' => $view,
      'form1' => $form1,
      'form2' => $form2,
      'form3' => $form3,
    ));
  }
  else {
    drupal_set_message(t('Image not found.'), 'error');
    $content = '';
  }
  return $content;
}