Getting two different fields from a thumbnail generated by Drupal´s Image Cache and the original image
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 t开发者_JAVA技巧humbnai, 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?
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);
...
?>
精彩评论