Tyler Frankenstein's Drupal Association Membership Tyler Frankenstein GItHub Link

Drupal - Image Field Caption

In Drupal 7, an image field comes with alt and title fields for your content type's image(s). The Image Field Caption module adds an extra text area to enter caption text or html for image field descriptions.

Image Field Caption Form Fields

Now when our image is displayed, we have our custom caption text, and we maintain accessibility with the alt and title attributes.

Image Field Caption Node View Example

To customize how the caption is displayed, we can make a copy of the image_field_caption.tpl.php file and place it in our theme's directory, for example:

sites/all/themes/MY_THEME/image_field_caption.tpl.php

Now we can modify the html to meet our needs:

<?php
/**
 * $image - contains the image html rendered by Drupal
 * $caption - contains the image field caption string
 */
?>
<?php print $image; ?>
<blockquote class"image_field_caption">
  <?php print $caption; ?>
</blockquote>

Enjoy!