Posted by giorgio79 on March 28, 2009 at 4:25am
Jump to:
| Project: | Content Templates (Contemplate) |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hello,
My imagecache presets do not appear in my body variabled.
Anyone else having this? Maybe some ideas? :)
Cheers,
G
Comments
#1
were them supposed to?
I hope so... i'd like to use them...
#2
subscribing
#3
If you're using CCK and your image is a field, try this:
In your Content Type, click the "Display Fields" tab. Select the ImageCache type you want to use in Teaser and Full Node dropdowns for your image field.
Your Imagecache presets should now appear in the Variables area of Contemplate. At least they did for me; hope this helps.
#4
very good advice :-)
#5
you should have the image path available - the path to the original image
With the path to the original image you can theme the image with the imagecache preset as follows:
<?php$presetname = 'my_imagecache_preset';
$alt = 'this image is cool!'; // this is the alt text for the <img> tag
$title = $node->title . ' image'; // this adds a title attribute to the <img> tag
$attributes = array(
'id' => 'my-iamgecache-id',
'class' => 'imagecache imagecache-'. $presetname,
); // adds other attributes to the <img> tag - note that if you pass in attributes imagecache won't add the normal imagecache classes
$getsize = TRUE; // this has imagecache set the width and height attributes in the <img> tag
print theme('imagecache', $presetname, $path_to_original_image, $alt, $title, $attributes, $getsize);
?>