You are here

function imagepicker_postlet_upload in Image Picker 6.2

Function to display the postlet applet

Parameters

$path: admin, user or iframe

$account: Optional, used by admin

Return value

Returns the themed applet.

3 calls to imagepicker_postlet_upload()
imagepicker_postlet_admin_page in contribs/imagepicker_postlet/imagepicker_postlet.module
callback from admin/settings/imagepicker
imagepicker_postlet_page in contribs/imagepicker_postlet/imagepicker_postlet.module
callback from iframe
imagepicker_postlet_user_page in contribs/imagepicker_postlet/imagepicker_postlet.module
callback from My imagepicker

File

contribs/imagepicker_postlet/imagepicker_postlet.module, line 139
Enables upload of images using Postlet java applet. http://www.postlet.com/ http://sourceforge.net/projects/postlet/

Code

function imagepicker_postlet_upload($path, $account = FALSE) {
  global $base_url;
  $label = "";
  $help = "";
  switch ($path) {
    case 'admin':
      if ($account) {
        $user = $account;
      }
      else {
        global $user;
      }
      $endpage = "{$base_url}/" . IMAGEPICKER_ADMIN_PATH . "/images/user/" . $user->uid . "/browse";
      $destination = "{$base_url}/imagepicker_postlet/admin/" . $user->uid . "/process";
      $label = t('Upload files for %name', array(
        '%name' => $user->name,
      ));
      break;
    case 'user':
      global $user;
      $endpage = "{$base_url}/user/" . $user->uid . "/imagepicker/images/browse";
      $destination = "{$base_url}/imagepicker_postlet/user/" . $user->uid . "/process";
      break;
    case 'iframe':
      global $user;
      $endpage = "";
      $destination = "{$base_url}/imagepicker_postlet/iframe/" . $user->uid . "/process";
      break;
  }
  $ret = _imagepicker_quota_check($path, $account);
  $quota_ok = $ret[0];
  $message1 = $ret[1];
  $message2 = $ret[2];
  $form = '';
  if ($quota_ok) {

    // get some defaults
    $maxthumbsize = variable_get('imagepicker_default_thumbnail_size', 100);
    $scaleto = variable_get('imagepicker_default_scale', FALSE);
    $watermark = FALSE;
    if (imagepicker_image_check_functions(TRUE) && variable_get('imagepicker_watermark_enable', 0)) {
      if (variable_get('imagepicker_watermark_image', '')) {
        $watermark = TRUE;
      }
      elseif ($user->imagepicker_watermark_enable && ($user->imagepicker_watermark_image ? $user->imagepicker_watermark_image : FALSE)) {
        $watermark = TRUE;
      }
    }
    $width = variable_get('imagepicker_postlet_width', "600");
    $height = variable_get('imagepicker_postlet_height', "175");
    $url = url(drupal_get_path('module', 'imagepicker_postlet') . '/postlet/postlet.jar', array(
      'absolute' => TRUE,
    ));
    drupal_add_css(IMAGEPICKER_PATH . '/imagepicker.css');
    drupal_add_css(drupal_get_path('module', 'imagepicker_postlet') . '/imagepicker_postlet.css');
    $form = theme('imagepicker_postlet_view', $url, $destination, $endpage, $maxthumbsize, $scaleto, $watermark, $width, $height);
  }
  return theme('imagepicker_quota_message', $message1, $message2, $form, $label, $help);
}