Currently a LIghtbox popup image displays the image node's title, but it would be nice if the image module would optionally include the image node's body and/or teaser text. Below is my hack to do just that, though I don't know how to make this a configurable option. In the "image.module" file, locate the following function:
function theme_image_display($node, $label, $url, $attributes) {
// $img_alt_tag=$node->title; // Show image title only
// $img_alt_tag = $node->title . "<br />" . $node->body; //Show image title and body
// $img_alt_tag=$node->body; // Show image body only
$img_alt_tag=node_teaser($node->body); // Show image body teaser only
return theme('image', $url, $img_alt_tag, $node->title, $attributes, FALSE);
}Notes
The middle four lines are new, but uncomment only the one you want. Each line re-defines the content of the Alt tag, which is then passed on to the final return statement.
Using the image node's teaser text lets Lightbox2 show a caption, but exclude detailed information.
See also
- Request to add "What links here" backlinks
- Hack to "Automatic add image caption from image body teaser"
Comments
Comment #1
drewish commentedi won't commit anything that doesn't go into D6 first but people are welcome to use this.
Comment #2
sunLightbox/Thickbox modules have to integrate with Image module - not the other way around.
Comment #3
gzerphey commentedSomewhat of an ugly hack, but it works. Lightbox does need to address this as I'm sure I'm not the only one that wanted this.