function theme_imagezoom_image in Image Zoom 7
Returns the HTML code for an image with a zoomed version on mouseover.
1 theme call to theme_imagezoom_image()
- imagezoom_field_formatter_view in ./
imagezoom.module - Implements hook_field_formatter_view().
File
- ./
imagezoom.module, line 182 - Provides an Image Zoom field formatter for Image fields.
Code
function theme_imagezoom_image($variables) {
if (!variable_get('imagezoom_load_all', 0)) {
drupal_add_js(drupal_get_path('module', 'imagezoom') . '/js/imagezoom.min.js');
}
$display_title = variable_get('imagezoom_display_title', 0);
$hide_thumbs = variable_get('imagezoom_hide_active_thumb', 0);
$settings = array(
'zoom_type' => variable_get('imagezoom_zoom_type', 'popup'),
'display_title' => $display_title,
'hide_thumbs' => $hide_thumbs,
'allow_click' => variable_get('imagezoom_allow_click', 0),
);
drupal_add_js(array(
'imagezoom' => $settings,
), 'setting');
drupal_add_css(drupal_get_path('module', 'imagezoom') . '/css/imagezoom.css');
$item = $variables['item'];
if (isset($item['file']) && is_object($item['file'])) {
$item['uri'] = $item['file']->uri;
$item['alt'] = '';
}
$image = array(
'path' => $item['uri'],
'alt' => $item['alt'],
);
// Do not output an empty 'title' attribute.
if (drupal_strlen($item['title']) > 0) {
$image['title'] = $item['title'];
}
$display_img = '';
if ($variables['display_style']) {
$image['style_name'] = $variables['display_style'];
$display_img = theme('image_style', $image);
}
else {
$display_img = theme('image', $image);
}
$zoom_img = '';
if ($variables['zoom_style']) {
$image['style_name'] = $variables['zoom_style'];
$zoom_img = image_style_url($variables['zoom_style'], $item['uri']);
}
else {
$zoom_img = file_create_url($image['path']);
}
$options = array(
'html' => TRUE,
'attributes' => array(
'class' => array(
'imagezoom',
),
'rel' => 'nofollow',
),
);
if (isset($image['title'])) {
$options['attributes']['title'] = $image['title'];
}
if (variable_get('imagezoom_colorbox', 0)) {
$options['attributes']['class'][] = 'colorbox';
}
$output = l($display_img, $zoom_img, $options);
return $output;
}