Compatibility with FCKEditor and Image Browser
expandonline - February 3, 2009 - 11:08
| Project: | Image Caption |
| Version: | 6.x-2.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
For compatibility with http://drupal.org/project/fckeditor and http://drupal.org/project/imagebrowser
I have modified image_caption.js to include the following lines - this transfers the 'class' attribute from the image to the containing div as in the case of imagebrowser, the alignment is done by it altering the 'class' rather than the 'align' attribute.
var imgclass = $(this).attr('class');
$(this).removeClass(imgclass);
$(this).wrap("");
Hope this is of help to someone - not sure how compatible it is with other editors & image inserters.
Peter

#1
I've modified it this way, so that the CSS 'float' property of the image is transfered to the div:
$(document).ready(function(){$("img.caption").each(function(i) {
var imgwidth = $(this).width();
var imgheight = $(this).height();
var captiontext = $(this).attr('title');
var alignment = $(this).attr('align');
if (alignment == undefined || alignment == '') {
alignment = $(this).css('float');
}
$(this).removeAttr('align');
$(this).css('float','');
$(this).wrap("<div class=\"image-caption-container\" style=\"float:" + alignment + "\"></div>");
$(this).parent().width(imgwidth);
$(this).parent().append("<div class=\"image-caption\">" + captiontext + "</div>");
});
});