Hi,
I'm using this module with fckeditor & IMCE to post inline images (with optional captions).
This combination allows images to only have alt tags, not titles so the captioning fails showing 'undefined'.
I have altered the module to create a preference in the settings page that allows the (admin) user to select the tag to process into captions, so you can select 'Title' or 'Alt'.
I also duplicated the image_caption.js, renaming it image_caption_alt.js and altered the caption text variable to var captiontext = $(this).attr('alt');
I added a switch statement to the module to add either the default JS file or to use the new_alt.js file.
This seems to work fine for me, and increases the usefulness of the module:)
I'm posting the relevant files in full since I'm pressed for time at the moment.
One problem remains though, if an image is set assigned the caption class, but the title (or alt in my case) is empty the caption is listed as 'undefined' can this be removed instead?
Sorry my JS skills are non-existent :-(
Drew
Comment | File | Size | Author |
---|---|---|---|
#4 | fckeditor-image-title.jpg | 29.98 KB | jaydub |
#3 | image_caption_alt.zip | 621 bytes | cr0546 |
alt_tag_captioning_mod.zip | 2.16 KB | drew reece |
Comments
Comment #1
panji CreditAttribution: panji commentedNice,.. I like it,... cause am prefer to use alt,... fckeditor using alt,... We can paste this to the D6 version as well,..
Thx bro...
Comment #2
aries CreditAttribution: aries commented+1
Simple but useful hack.
Comment #3
cr0546 CreditAttribution: cr0546 commentedFirst thanks drew reece and davidwhthomas, you guys really helped me.
I have hacked image_caption.js too allow other classes to be included on the processing, and to allow use of both ALT and TITLE attributes to be used as caption (like ALT br TITLE if both exists, ALT or TITLE if one is blank).
This hack comes from a need of mine to include captions on images uploaded through imagefield module, which has no caption feature till now.
Thanks.
Comment #4
jaydub CreditAttribution: jaydub commentedAs far as I know FCKEditor can add image TITLE tags. The attached screenshot shows where you can add the TITLE. In the 'Advanced' tab of the image dialog, the field 'Advisory Title' is the TITLE attribute. A pretty terrible label for it I know :)
Comment #5
Steve Dondley CreditAttribution: Steve Dondley commentedI have hacked my fckeditor to put the "Advisory Title" field into the first tab. I've also change it to say "Image Caption". If you want details, let me know. I'll post them here.
Comment #6
milos1234 CreditAttribution: milos1234 commentedYes please, although I cant even get the image captions to show up with this method.
Are there any changes needed from the default FCK/IMCE combo to display?
Thanks!
Comment #7
geerlingguy CreditAttribution: geerlingguy commentedI would like to use alt instead as well; typically I put a short descriptive title in the 'title' field, but a caption-like statement in the alt field.
I changed my copy of the module to use alt instead of title, but it would be best if there were an option in the admin interface that allows people to select either "alt" or "title."
Comment #8
Vacilando CreditAttribution: Vacilando commentedVery interested in this as well (for Drupal 7). On a site I built there is an awful lot of images with this embarrassing caption: "undefined" now.