You are here

function theme_cloud_zoom_image in Cloud Zoom 7

Same name and namespace in other branches
  1. 8 cloud_zoom.module \theme_cloud_zoom_image()

Theme handler for the cloud_zoom (no gallery)

1 theme call to theme_cloud_zoom_image()
cloud_zoom_field_formatter_view in ./cloud_zoom.module
Implements hook_field_formatter_view().

File

./cloud_zoom.module, line 543
This module integrates the Cloud Zoom JQuery library from: http://www.professorcloud.com/mainsite/cloud-zoom.htm

Code

function theme_cloud_zoom_image($variables) {

  // Add the Cloud Zoom Library
  drupal_add_library('cloud_zoom', 'cloud-zoom');
  $item = $variables['item'];
  $slide = cloud_zoom_get_img_tag($variables['slide_style'], $item);

  // Build a Zoomed In URL path
  $zoomed = $variables['zoom_style'] ? image_style_url($variables['zoom_style'], $item['uri']) : file_create_url($item['uri']);
  $rel = cloud_zoom_get_rel_string($variables);
  $attributes = array(
    'class' => array(
      'cloud-zoom',
    ),
    'rel' => $rel,
  );
  if (!empty($variables['colorbox']) && module_exists('colorbox')) {
    $attributes['class'][] = 'colorbox';
    $attributes['title'] = $item['title'];
  }

  // Return the preview image as a link to the larger image with a cloud-zoom CSS class
  return l($slide, $zoomed, array(
    'html' => TRUE,
    'attributes' => $attributes,
  ));
}