imagecache doesn't show alt values
finedesign - April 8, 2009 - 21:18
| Project: | Image Caption |
| Version: | 6.x-2.3 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm not using a WYSIWYG editor to add images inline, rather the image cache module. I have manually added the following code to the node.tpl file:
<?php $attr['class'] = 'right caption';
print theme('imagecache', 'presetname_lg', $node->field_image[0]['filepath'], $alt, $title, $attr ); ?>For some reason, image cache is not displaying the alt information. Instead, the "title" information is displayed as the caption...and the image title always prints the title of the node! In addition, if there is NO image displayed on a particular node, image_caption displays the div anyway, along with the "title" values.
This is the generated markup for the page (from the code above):
<div class="image-caption-container" style="width: 300px;">
<img class="right caption" width="300" height="225" align="" title="PHY (Assistance to the Physically Challenged)" alt="" src="http://www.adrayemen.org/sites/default/files/imagecache/programs_lg/Picture 665resize.jpg"/>
<div class="image-caption">PHY (Assistance to the Physically Challenged)</div>
</div>Note how the "alt" value is empty, and the title is actually the title of the node.

#1
subscribing
#2
I'm rather new to php and Drupal, but I stumbled across this post while trying to get this module to work together with Image Cache and Content Templates, and this seems to be working for me. Hope it helps.
<?php $attr['class'] = 'right caption';print theme('imagecache', 'presetname_lg', $node->field_image[0]['filepath'], $node->field_image[0]['alt'], $node->field_image[0]['title'], $attr ); ?>