It would be nice if a caption option was integrated. Afterall, a caption is a very common thing; and as is, generating one is rather cumbersome. The CCK field already includes a title form field that generates an HTML title attribute. That could be used to automate a caption -- ideally able to be overriden with custom text or disabled on a use-by-use basis. The Slideshow module produces a caption from the title attribute automatically.

EXAMPLE:
I have a CCK imagefield for story thumbnail. It, along with Imagecache, automatically generates the full-sized image on the full node. But, that image has no display caption -- only the mouseover title. I have added a CCK thumbnail caption field, but the HTML generated wraps the value in its own DIV -- so it is not property position with the image. The two need to be in the same container. Caption (title) wrapped in a tag and positioned underneath the photo would be good.

Since that image is not displayed via the node.tpl.php file, it makes it tough to marry these. Contemplate is an option, but it requires a rewrite/override of the whole node template and seems like overkill. And it is not client/staff user-friendly.

Perhaps I have overlooked other options. But, I still think that providing an automated option as does the Slideshow module would be tremendously useful. Best for clients/staff who know nothing of modifying template files. Since this functionality exists in another module, wouldn't it be fairly easy to implement?

In general, there really should be a built-in way to add a caption.

Thanks for the great contribution of Imagefield.

Comments

quicksketch’s picture

Status: Active » Closed (won't fix)

This has been brought up several times and it's been considered. A Caption will not be added because it is not part of the <img> tag. If you start adding things like caption, you could also rationalize Photographer, or License, or Date or Year, etc etc. If you'd like to add more fields to individual image fields, use ImageField Extended.

greta_drupal’s picture

Thought that I would post my solution to my example above, for others who might be interested. Shout out to Philip Blaauw (http://drupal.org/project/ddblock) who suggested an even more streamlined template mod to achieve my goal.

RECAP: I had a CCK imagefield to store a thumbnail; as part of appropriate content types. The imagefield automatically adds a form field for the Title attribute, along with the image name, to the node add/edit form. So, this solution utilizes that Title attribute to automatically generate a caption for the full image version of the thumbnail that appears on the node page. (Imagecache resizes the images.)

  1. Copied the content-field.tpl.php file from Imagecache module folder to my theme folder.
  2. Saved that same file as content-field-field_imgthumbnail.tpl.php and added the following code after <?php print t($label) ?>:&nbsp;</div><?php } ?>:
    			<?php print $item['view'] ?>
    			<?php if ($page) { ?>
    				<?php print '<br /><span class="image-caption">' . $item['data']['title'] . '</span>';?>
    			<?php } ?>
    
  3. Added to the CSS some new styles for the caption.

NOTES: "imgthumbnail" is the name of my CCK field for story thumbnails. You would replace this with whatever you have named your CCK field.
Also, I did not want the caption to print with the teaser, so I added code to single out only the page.