Skip to content

Instantly share code, notes, and snippets.

@cam8001
Created November 5, 2012 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cam8001/4016570 to your computer and use it in GitHub Desktop.
Save cam8001/4016570 to your computer and use it in GitHub Desktop.
Drupal 6 syntax for theme_imagecache
<?php
// The raw path to the image.
$path = $node->field_product_image[0]['filepath'];
// Let imagecache generate a different sized image using 'Product_large'
$large_path = imagecache_create_url('Product_large', $path);
// Render the original image and save the path to the large one in the tag.
// Your output will be something like:
// <img src="blah.jpg" large_img="large-blah.jpg" class='img-swap' />
theme('imagecache', $path, '', '', array('large_img' => $large_path, 'class' => 'img-swap'));
?>
Drupal.behaviors.swapProductImages = function(context) {
// Find all the images that have a swap on hover.
$('img.img-swap', context).mouseup(function(){
// For each image, swap in the larger sized image we saved in the <img /> tag.
zxcImageViewerII.SwapImage('tst6', this.src, $(this).attr('img-swap'));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment