You are here

function imagepicker_userview in Image Picker 7

1 call to imagepicker_userview()
imagepicker_user_page in ./imagepicker.user.inc
@file @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

File

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

Code

function imagepicker_userview($img_id) {
  $imagepicker_jspaths = imagepicker_jspaths_get();
  drupal_add_js($imagepicker_jspaths['imagepicker_jspath']);
  $form1 = '';
  $form2 = '';
  $form3 = '';
  $img = _imagepicker_get_img($img_id);
  if ($img) {
    $imgpath = imagepicker_get_image_path($img, 'full');
    $info = image_get_info(imagepicker_get_path(FALSE, TRUE) . $img->img_name);
    $exifinfo = "";
    if ($info['extension'] != 'gif') {
      $exifinfo = imagepicker_get_exifinfo(imagepicker_get_path(FALSE, TRUE) . $img->img_name);
    }
    $view = theme('imagepicker_fview', array(
      'img' => $img,
      'imgpath' => $imgpath,
      'info' => $info,
      'exifinfo' => $exifinfo,
    ));
    $form1 = drupal_get_form('imagepicker_user_image_form', $img_id);

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

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