Not sure if i'm missing this - but is it possible to display the image title instead of the file name?

Obviously i can manually disable the file name display, but displaying the title instead will be a great feature.

Comments

dnewkerk’s picture

I'd like to second this request... this would be a useful feature. Right now using Thickbox (for example) a user can enter the optional "Title" field when uploading their image to an Imagefield. Thickbox then displays this title under the Image when it's shown within Thickbox, instead of the file name.

As a related side note, would it also be possible to store the HTML for "View Image Details" in some other location besides directly within the Title field of the link? As it currently is, HTML is stuffed into the Title tag, and this is very unusable for disabled users who might be relying on a screen reader to navigate the page.

Thanks!

dnewkerk’s picture

asak -

In case you're interested, I dug around and figured out how to do this. Hopefully the module maintainer will consider adding it as a feature, but for now it will work. It's just slightly tricky, but does not require you to hack the module, since the code involved is part of an over-ridable theme function.

Open up lightbox2.module and search for the code that starts with a comment that says "Implementation of theme_imagefield_image_imagecache_lightbox2()." Copy everything from the comment down to the end of that section of code (before the next comment) which ends with:

return $output;
}

Paste the code into your template.php file in your theme directory (when you copy a theme override from core or a module into template.php, your changes to the new copy will work, without hacking the original file).

Change the first line that reads function theme_imagefield_image_imagecache_lightbox2 to function phptemplate_imagefield_image_imagecache_lightbox2
(note, what is changed is the word theme to the word phptemplate)

Find this line:
'title' => $item['alt'] . $node_link);

And replace it with this:
'title' => $item['title'] . $node_link);

Save template.php. Now the title attribute will be used instead of the alt attribute. This change will also not be lost when you upgrade the Lightbox2 module (though could possibly stop working if there are significant changes to the module).

Good luck!

asak’s picture

Keyz - Thank you!

That's perfect.

stella’s picture

Status: Active » Fixed

I've changed the module so it now uses $item['title'] instead. It will be included in the next release.

Keyz: regarding your point about putting the "View Image Details" HTML somewhere else, I don't think this is possible. It has come up before. If you can suggest a possible alternative, I'll certainly look into it. Please open it in a separate issue however.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

stella’s picture

Released in Lightbox2 6.x-1.6 and 5.x-2.6.

Cheers,
Stella