Created
November 5, 2012 10:41
-
-
Save cam8001/4016570 to your computer and use it in GitHub Desktop.
Drupal 6 syntax for theme_imagecache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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