alt and title attributes

pippal - April 2, 2009 - 17:54
Project:Image Picker
Version:5.x-1.4
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm not at all any kind of programmer, but I want make the 'title' of the image the title attribute in the HTML, not the alt attribute as it is at the moment, and make the alt attribute = the 'Description' from the edit/upload form in image picker.

I have made an attempt by changing a tiny bit of code in imagepicker.module

added a line at 757

var imgpImageDescription = '". ($img['img_description'] ? addslashes(check_plain($img['img_description'])) : t('Image')) ."';

and changed line 821 to

imgpImageElement = '<img src=\"'+imgpImagePath+'\" title=\"'+imgpImageTitle+'\" alt=\"'+imgpImageDescription+'\" ' + imgpImageStyle + ' \/>';

And it seems to work!!

It made more sense to me to have title = title and alt = description

Sorry if this is already a feature.

I've put it here as a kind of FYI for any one who might want to request / do the same.

I will also be adding class="caption" in the out put but thats just because I want the image_caption module to generate an image caption based on the alt and/or title tags.

I may try in the future using the title and description variables to out put similar html that image-caption out puts.

Pip.

 
 

Drupal is a registered trademark of Dries Buytaert.