Closed (fixed)
Project:
BUEditor
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Aug 2007 at 13:35 UTC
Updated:
30 Mar 2008 at 21:42 UTC
Hi there,
It could be great if bueEditor support imagecache.
for example, when you want to add a picture and imagecache is enabled, to add a list of imagecache available preset and choose one...
thanks
zmove
Comments
Comment #1
simeI'm not much of js coder, so I'll describe my solution for the record but its not that pretty.
1. I created a new module to insert an extra js function. This function is a hack of eDefTagInsert with the only difference being it looks for a 'display' attribute and modifies the image path to be an imagecache image instead. Below is the contents of the js, I then obviously add it with drupal_add_js().
Then my button is pretty simple. You can see where I've hard-coded the desire imagecache presets.
options: {medium: 'medium', wide: 'wide'}Now this works, but it's not robust. I post it here for collaboration purposes, not as a solution that you should use live unless you know what you're doing. Thanks
Comment #2
ufku commentedhi simon,
thanks for your contribution :). If you dont mind i want to add my 2 cents.
you may consider shortening the imagecacheInsert code by writing "eDefTagInsert(tag, form)" instead of the whole code after the attr_src manipulation.
It should work if the replaced code is completely the same as eDefTagInsert code.
I don't know if the display atrribute (which is non-standard) is necessary but you can delete it before sending the form to eDefTagInsert.
delete form.elements['attr_display'];Comment #3
simeMuch neater!!
You're right, the 'display' attribute is just used to alter the image path. Imagecache module handles the rest. So I will certainly be using the
delete form.elements['attr_display'];line.I was also trying to include my custom function inside the button code - directly after:
return "js:But I was getting the error that 'imagecacheInsert' was not a valid function. Is there a way to achieve this? (It would be great to avoid making a separate .js file.)
Comment #4
ufku commentedyes, it is possible to make the function global.
define it in this format:
imagecacheInsert = function(tag, form) {...}Note:
function imagecacheInsert(tag, form){}is the same as
var imagecacheInsert = function(tag, form){}in which the "var" keyword makes it local. Excluding the "var" makes it global.
Marking this issue as fixed to make it a reference for imagecache-bueditor integration.
Comment #5
simeawesome - thanks for the follow up!
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.