You are here

function template_preprocess_imagezoom_image in Image Zoom 7.2

Same name and namespace in other branches
  1. 8.3 imagezoom.module \template_preprocess_imagezoom_image()
  2. 8.2 imagezoom.module \template_preprocess_imagezoom_image()

Preprocess function for imagezoom_image.

File

./imagezoom.module, line 238
Provides an Image Zoom field formatter for Image fields.

Code

function template_preprocess_imagezoom_image(&$variables) {
  $library = libraries_load('elevatezoom-plus');
  if (!$library['loaded']) {
    drupal_set_message($library['error message'], 'error');
  }
  drupal_add_js(array(
    'imagezoom' => $variables['settings'],
  ), 'setting');
  drupal_add_js(drupal_get_path('module', 'imagezoom') . '/js/imagezoom.js');
  $item = $variables['item'];
  if ($variables['display_style']) {
    $variables['image'] = image_style_url($variables['display_style'], $item['uri']);
    $info = image_get_info($variables['image']);
  }
  else {
    $variables['image'] = file_create_url($item['uri']);
    $info = image_get_info($item['uri']);
  }
  $variables['width'] = $info['width'];
  $variables['height'] = $info['height'];
  $variables['alt'] = $item['alt'];
  $variables['title'] = $item['title'];
  if ($variables['zoom_style']) {
    $variables['zoom'] = image_style_url($variables['zoom_style'], $item['uri']);
  }
  else {
    $variables['zoom'] = file_create_url($item['uri']);
  }
}