views:

238

answers:

1

I have an image field, which imagecache automatically creates a thumbnail for. I am creating my own node view, in which I would like to show both the full size image and the thumbnai, but drupal treats them as a single field (one or the other will be shown depending on which option you choose in "Display Views").

How can I make ImageCache treat the original image and the thumbnail, as two separate fields, or two different keys in the field array?

+1  A: 

What module did you use for image attaching to node? imagefield, image, ...?

However, one way is theming node (if you use CCK and imagefield modules):
Create node-{YOURNODETYPENAME}.tpl.php (you can take source from node.tpl.php) in your theme folder.
And add there this code (image field named as image, also you should disable output of this field in settings of fields of this content type, or remove one of print... line):

<?php
$img = current($node->field_image);
$alt = $img['data']['description'] ? $img['data']['description'] : $title;
...
print theme('imagecache', 'YOURIMAGECACHENAME', $node->img['filepath'], $alt);
...
print theme('image', $node->img['filepath'], $alt);
...
?>
Nikit
I am using cck with imagefield, and I have already created the node template. I don't really understand the disabling output of the field part, could you please explain further? Is each print command supposed to output the thumbnail version and the original version of the image?Thank you very much.
0al0
you CAN disable, just test it and see what you get. theme(imagecache is for printing via imagecache module. theme(image just for printing image.
Nikit
Oh, I get it now. Thanks a lot Nikit. BTW, if you also know how to do this it would be amazing: right now, when one of the images is clicked, it takes you to the image, is there a module that instead of that, opens some kind of jquery lightbox with the image?
0al0
Please read readme.txt or api.txt files in modules of imagecache or lightbox, it's very useful. Answer, use like this: print l(theme('imagecache', 'IMAGECACHENAME', $img['filepath'], $alt), $img['filepath'], array('html'=>true, 'attributes'=>array('rel'=>'lightbox[]['.$alt.']')))
Nikit
I will. Thank you, have a nice day
0al0

related questions