1. Installed Image Assist 6.x-2.0-alpha2 to sites/mysite/modules (Drupal 6.5)
2. Installed FCKEditor module 6.x-1.3-rc7 to sites/mysite/modules with FCKeditor 2.6.3
3. Configured FCKEditor according to sites/mysite/modules/fckeditor/README.txt
4. Copied img_assist_fckeditor.js from sites/mysite/modules/fckeditor/ to sites/mysite/modules/img_assist/

FCKEditor toolbar containing Image Assist button appears on body textareas, however on pressing Image Assist button, a blank window pops up with two Javascript errors for img_assist_fckeditor.js:

getArgs is not defined
onload(load )
[Break on this error] var args = getArgs(); // get the querystring arguments
URL: http://mysite/index.php?q=img_assist/load/fckeditor&textarea=body


insertToEditor is not defined
[Break on this error] var oldInsertToEditor = insertToEditor;
URL: http://mysite/index.php?q=img_assist/load/fckeditor&textarea=body

Error occurs on Firefox 3.0.5 & Internet Explorer 6.0. I have read the same issue in: "FCKeditor and Image Assist not working together" http://drupal.org/node/321844, and; "FCKeditor & Image Assist" http://drupal.org/node/249684, both for earlier versions of the module. I am assuming the version I am using rc7 has the fixes from these issues included? If not what should I do to fix this problem? (Note: moving img_assist_fckeditor.js to /misc/ folder, as suggested in #249684, did not work).

My site is not live, if you require additional information please let me know. Thanks in advance!


altavis’s picture


I have exactly the same problem, except I'm using FCKEditor module 6.x-2.0-alpha5. When fckeditor is disabled image assist works fine.

And found solution. Problem is in loading img_assist_textarea.js into img_assist_fckeditor.js so the simplest solution is just copy img_assist_textarea.js content into img_assist_fckeditor.js and delete first couple of lines defined in "// Load the img_assist_textarea.js script" section.

no longer here 422758’s picture

Thanks, that appears to solve the problem.

AltoRetrato’s picture

I found out that the problem is in the URL to the img_assist_textarea.js file. The code below (from img_assist_fckeditor.js) was generating the address "/misc/img_assist_textarea.js":

script.src = head.getElementsByTagName('script')[1].src.match( /.*\// ) + 'img_assist_textarea.js';

Below that line I added the following code:

script.src = '/sites/all/modules/img_assist/' + 'img_assist_textarea.js';

... and the image_assist module finally worked.

wwalc’s picture

Status: Active » Fixed

Fixed in CVS. Download the latest dev release (should be available after midnight) and let me know if it works for you as expected.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jzurheide’s picture

Version: 6.x-1.3-rc7 » 6.x-2.0-beta1
Status: Closed (fixed) » Active


I just got this same problem again.

- Image Assist 6.x-3.x-dev (2009/03/29)
- FCKeditor - WYSIWYG HTML editor 6.x-2.0-beta1
- FCKEditor 2.6.4

The two error messages:

insertToEditor is not defined
Line 1898

getArgs is not defined
Line 1963

The code i got from Firebug:

1887// Source dirname is built from the second script tag found in the document
1888for (var i = 0; i < head.getElementsByTagName('script').length; i++) {
1889 if ( head.getElementsByTagName('script')[i].src.match( /img_assist/ ) ) {
1890 fckeditor_add_script(head.getElementsByTagName('script')[i].src.replace( /img_assist[_a-z]*\.js/, 'img_assist_textarea.js' ));
1891 break;
1892 }
1895setTimeout("InitFCKeditorImgAssist();", 1000);
1897function InitFCKeditorImgAssist() {
1898 var oldInsertToEditor = insertToEditor;
1900 insertToEditor = function(content) {
1902 //handle FCKeditor in popup mode
1903 if ((myTextarea == '') && (window.opener)) {
1904 var myDoc = window.opener;
1905 if (myDoc.oFCKeditor) {
1906 var inst= myDoc.oFCKeditor.InstanceName;
1907 var oEditor = myDoc.FCKeditorAPI.GetInstance( inst );
1908 if (oEditor.EditMode == myDoc.FCK_EDITMODE_WYSIWYG) {
1909 oEditor.InsertHtml(content) ;
1910 }


1953if (typeof(initLoader) == 'undefined') {
1954 var myDoc, myForm, myTextarea, hasInputFormat;
1956 var initLoader = function() {
1957 // Save the references to the parent form and textarea to be used later.
1958 myDoc = window.opener.document; // global (so don't use var keyword)
1959 myForm = '';
1960 myTextarea = '';
1961 hasInputFormat = false;
1963 var args = getArgs(); // get the querystring arguments
1964 var textarea = args.textarea;
1966 // Reference the form object for this textarea.
1967 if (myDoc.getElementsByTagName) {
1968 var f = myDoc.getElementsByTagName('form');
1969 for (var i=0; i<f.length; i++) {
1970 // Is this textarea is using an input format?
1971 if (f[i]['edit-format']) {
1972 hasInputFormat = true;
1973 }
1974 if (f[i][textarea]) {
1975 myForm = f[i];
1976 myTextarea = f[i][textarea];

The strange thing about it is the fact that i have a local install with the same components and no problems. Perhaps it has to do with any other module?

jzurheide’s picture

After i disabled the JavaScript optimization in the performance settings it works again!
Emptying the cache does not help, though...

EvanDonovan’s picture

I have no idea why this is happening. Until it's fixed, though, the problem can be resolved by the copy-and-paste technique described in comment #1.

Jorrit’s picture

Status: Active » Closed (duplicate)