Hi, I need some help. I read a quick explanation in another issue saying it's possible to rewrite the <img markup for images inserted inline. I'm in need of doing this to create image captions. However, for me it seems this javascript file isn't even used when I insert a picture, leading me to believe I'm not submitting it correctly (or inline at all). Because it's not used, I can't modify the <img tag markup.

I'm trying to change this portion:

//sendTo function
ii.insert = function (file, win) {
var type = ii.activeType == 'link' ? 'link' : (file.width ? 'image' : 'link');
var html = type == 'image' ? ('<img src="'+ file.url +'" width="'+ file.width +'" height="'+ file.height +'" alt="'+ file.name +'" />') : ('<a href="'+ file.url +'">'+ file.name +' ('+ file.size +')</a>');
ii.activeType = null;
win.blur();
ii.insertAtCursor(ii.activeTextarea, html, type);
};

To include my jCaptions syntax, where the alt (file.name) is the caption:

ii.insert = function (file, win) {
var type = ii.activeType == 'link' ? 'link' : (file.width ? 'image' : 'link');
var html = type == 'image' ? ('<div class="caption"><img src="'+ file.url +'" width="'+ file.width +'" height="'+ file.height +'" alt="'+ file.name +'" /><div class="image-caption"><p>'+file.name+'</p></div></div>') : ('<a href="'+ file.url +'">'+ file.name +' ('+ file.size +')</a>');
ii.activeType = null;
win.blur();
ii.insertAtCursor(ii.activeTextarea, html, type);
};

Any idea why imce_set_inline.js is not being used? I can even delete the file and still insert an image without issue-- that's why I know it's not being used. I'm using this with TinyMCE btw. Any tips appreciated!

Comments

imce_set_inline.js is used for plain textareas not for wysiwyg editors. You'll need a custom plugin to change the markup that tinymce inserts.

ufku:

Anymore details would be appreciated. I just want to have a class added to all images inserted with IMCE.

Would the plugin you're speaking of modify IMCE, TinyMCE, WYSIWYG, or CORE? Any idea? Also, any idea what file needs to be modified?

You'll need a tinymce plugin that opens IMCE with a file handler callback.
http://www.tinymce.com/wiki.php/Tutorials:Creating_a_plugin
http://ufku.com/drupal/imce/api (using sendto)