Needs review
Project:
Image Caption
Version:
6.x-2.3
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 May 2009 at 14:47 UTC
Updated:
1 Mar 2010 at 19:21 UTC
Jump to comment: Most recent file
The following change to code in image_caption.js allows images to have captions, including hyperlinks and left or right alignment.
/*$Id: image_caption.js,v 1.2 2008/03/07 05:46:23 davidwhthomas Exp $*/
$(document).ready(function(){
$("img.caption").each(function(i) {
var imgwidth = $(this).width();
var imgheight = $(this).height();
var captiontext = $(this).attr('title');
var alignment = $(this).css('float');
/*$(this).attr({align:""});*/
$(this).wrap("<div class=\"image-" + alignment + " \"></div>");
$(this).parent().width(imgwidth);
$(this).parent().append("<div class=\"image-caption\">" + captiontext + "</div>");
});
});
I'm using the TinyMce Image Dialog under IMCE Wysiswg API Bridge.
I added styles for .image-caption .image-right and .image-left
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | image_caption.js_.patch | 624 bytes | shaisachs |
Comments
Comment #1
shaisachs commentedI think from the point of view of Image Caption, which has to support other editors besides TinyMCE, it's better to use the float as a fall-back, rather than rely on it exclusively. The problem appears to be that TinyMCE positions images using float, rather than align, but Image Caption currently relies upon align. The attached patch seems to capture the best of both worlds.
Comment #2
thaddeusmt commentedThanks for this patch, works better with CKEditor now!
One thing though... it's bad form to have
Comment #3
SMonsen commentedI tried both patches and neither work with right aligned images. I'm running 6.x with WYSIWYG API and FCK 2.6.