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.

Comments

PepeMty’s picture

subscribing

mrtcereal’s picture

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 ); ?>
bradweikel’s picture

Project: Image Caption » ImageCache
Version: 6.x-2.3 » 6.x-2.x-dev

This is an imagecache issue, not image_caption.

Note that the caption = title behavior is the expected behavior for the image_caption module, so the only (possible) issue is with the alt attribute in the theme call.

Zoltán Balogh’s picture

subscribing

bradweikel’s picture

Project: ImageCache » Image Caption
Status: Active » Fixed

Not sure what I was thinking back in January, but looking at this again it seems the issue is pretty simple:

In node.tpl.php, $title is the node title and there is no defined $alt, so the result is exactly what you'd expect. The suggested fix in #2 is the correct one: it passes the title and alt values from the actual image field.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

justinchev’s picture

Priority: Normal » Minor

Just in case it helps anyone I was trying to render out the title and alt tags in a custom template using imageCache in conjunction with Ubercart and this is what got it working for me - noting what is used for the the ALT and TITLE :

print theme('imagecache', 'presetName', $first['filepath'], $node->field_image_cache[0]['data']['alt'], $node->field_image_cache[0]['data']['title']);