You are here

function theme_imagepicker_iframe in Image Picker 7

Same name and namespace in other branches
  1. 5.2 imagepicker.module \theme_imagepicker_iframe()
  2. 5 imagepicker.module \theme_imagepicker_iframe()
  3. 6.2 imagepicker.module \theme_imagepicker_iframe()
6 theme calls to theme_imagepicker_iframe()
imagepicker_browse in ./imagepicker.functions.inc
Menu local task; presents the browse and select pages for imagepicker
imagepicker_browse_public in ./imagepicker.functions.inc
imagepicker_groups in ./imagepicker.group.inc
@file @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
imagepicker_image_edit in ./imagepicker.edit.inc
imagepicker_image_select in ./imagepicker.functions.inc

... See full list

File

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

Code

function theme_imagepicker_iframe($variables) {
  $content = $variables['content'];
  $img = isset($variables['img']) ? $variables['img'] : '';
  $public = isset($variables['public']) ? $variables['public'] : FALSE;
  drupal_add_css(IMAGEPICKER_PATH . '/imagepicker.css');
  if ($img) {
    global $user;
    $presetfilelink = '';
    $presetthumblink = '';
    if (module_exists('image') && imagepicker_variable_get('imagepicker_image_enable', 0)) {
      $preset_opts = image_style_options(FALSE);
      $pfl = array();
      $ptl = array();
      foreach (array_keys($preset_opts) as $preset_key) {
        $pfl[$preset_key] = imagepicker_get_image_path($img, 'full', $public ? array(
          'name' => $img->name,
          'uid' => $img->uid,
        ) : FALSE, $preset_key);
        $ptl[$preset_key] = imagepicker_get_image_path($img, 'thumb', $public ? array(
          'name' => $img->name,
          'uid' => $img->uid,
        ) : FALSE, $preset_key);
      }
      $presetfilelink = $pfl;
      $presetthumblink = $ptl;
    }
    $info = image_get_info(imagepicker_get_path(FALSE, TRUE) . $img->img_name);
    $thumbinfo = image_get_info(imagepicker_get_path(FALSE, TRUE) . IMAGEPICKER_THUMBS_DIR . DIRECTORY_SEPARATOR . $img->img_name);
    $img_title = $img->img_title;
    $settings = array(
      'imagepicker_iframe' => array(
        'imgpImageAlt' => $img_title ? $img_title : t('Image'),
        'imgpImageTitle' => $img_title ? htmlspecialchars_decode($img_title, ENT_QUOTES) : '',
        'imgpImageDesc' => preg_replace("/(\n|\r)/", '', nl2br($img->img_description)),
        'imgpFileLink' => imagepicker_get_image_path($img, 'full', $public ? array(
          'name' => $img->name,
          'uid' => $img->uid,
        ) : FALSE),
        'imgpPresetFileLink' => $presetfilelink,
        'imgpThumbLink' => imagepicker_get_image_path($img, 'thumb', $public ? array(
          'name' => $img->name,
          'uid' => $img->uid,
        ) : FALSE),
        'imgpPresetThumbLink' => $presetthumblink,
        'imgpPageLink' => url('imagepicker/image/' . $img->img_id),
        'imgpTemplate' => imagepicker_get_insert_template(),
        'imgpWidth' => $info['width'],
        'imgpHeight' => $info['height'],
        'imgpThumbWidth' => $thumbinfo['width'],
        'imgpThumbHeight' => $thumbinfo['height'],
        'isFCKeditor' => module_exists('fckeditor') ? 'yes' : 'no',
        'isWysiwyg' => module_exists('wysiwyg') ? 'yes' : 'no',
        'use_cssbox' => imagepicker_variable_get('imagepicker_use_cssbox', imagepicker_variable_get('imagepicker_use_cssbox', 0), $user->uid),
        'use_relbox' => imagepicker_variable_get('imagepicker_use_relbox', imagepicker_variable_get('imagepicker_use_relbox', 0), $user->uid),
        'use_linkbox' => imagepicker_variable_get('imagepicker_use_linkbox', imagepicker_variable_get('imagepicker_use_linkbox', 0), $user->uid),
        'insert_image_title' => imagepicker_variable_get('imagepicker_insert_image_title', imagepicker_variable_get('imagepicker_insert_image_title', 0), $user->uid),
        'default_align_show' => imagepicker_variable_get('imagepicker_default_align_show', imagepicker_variable_get('imagepicker_default_align_show', 1), $user->uid),
        'default_fleft' => imagepicker_variable_get('imagepicker_default_fleft', imagepicker_variable_get('imagepicker_default_fleft', 'style="float: left"'), $user->uid),
        'default_fright' => imagepicker_variable_get('imagepicker_default_fright', imagepicker_variable_get('imagepicker_default_fright', 'style="float: right"'), $user->uid),
        'lightbox2_enable' => module_exists('lightbox2') && imagepicker_variable_get('imagepicker_lightbox2_enable', 1),
        'lightbox2_insert' => imagepicker_variable_get('imagepicker_lightbox2_insert', imagepicker_variable_get('imagepicker_lightbox2_insert', 'lightbox'), $user->uid),
        'colorbox_enable' => module_exists('colorbox') && imagepicker_variable_get('imagepicker_colorbox_enable', 0),
        'colorbox_iframe' => imagepicker_get_colorbox_perms(),
        'node_editbody' => 'edit-body-' . imagepicker_variable_get('imagepicker_node_lang', '') . '-' . imagepicker_variable_get('imagepicker_node_pos', 0) . '-value',
      ),
    );
    drupal_add_js($settings, 'setting');
    $jspaths = imagepicker_jspaths_get();
    drupal_add_js($jspaths['imagepicker_iframe_jspath']);
  }
  return $content;
}