I installed and activated Image Assist. When I click on the Image Assist button either on the FCK editor, or the button under the plain text edit window, a new window pops up but is completely empty. The html source in the popup is in the attached text file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN">
<html>
<head>
<title>Add image</title>
<script type="text/javascript" src="/scc/misc/jquery.js?z"></script>
<script type="text/javascript" src="/scc/misc/drupal.js?z"></script>
<script type="text/javascript" src="/scc/sites/all/modules/img_assist/img_assist_popup.js?z"></script>
<script type="text/javascript" src="/scc/sites/all/modules/img_assist/img_assist_fckeditor.js?z"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/scc/" });
//--><!]]>
</script>
</head>

<frameset rows="38, *" onload="initLoader()" frameborder="0" border="0" framespacing="0">
<frame name="img_assist_header" src="" class="img_assist_header" noresize="noresize" />
<frame name="img_assist_main" src="" class="img_assist_main" noresize="noresize" />
</frameset>
</html>

Could it be that the relative paths (e.g., "/scc/misc/jquery.js?z") are messing things up? This happens on both my dev machine where the site home page is:
http://localhost/scc
and on my server, where it's
http://joecascio.net/scc

The scc is a symbolic link to the main drupal directory.

CommentFileSizeAuthor
imageAssistHTML.txt874 bytesJoeCascio

Comments

JoeCascio’s picture

Oh, by the way, using Drupal 6.9.

e_wolf’s picture

Does it work with textarea (when FCKeditor module is disabled)?

Did you copy img_assist_fckeditor.js from FCKEditor module folder to img_assist folder?

JoeCascio’s picture

Just tried disabling FCKeditor and yes, it does work!

I copied image_assist_fckeditor.js to the image_assist folder and re-enabled FCKeditor but that does not work.
FCKeditor has to be disabled, it seems.

However now, even when popup window does appear, if you try to upload select images or really do anything it generates errors like this:

warning: Division by zero in /home/jc/public_html/joecascio.net/public/drupal/sites/all/modules/img_assist/img_assist.module on line 883.

JoeCascio’s picture

Version: 6.x-2.x-dev » 6.x-2.0-alpha3

Double-checked the version number and updated this issue: 6.x-2.0-alpha3

dman’s picture

I'm getting the similar.

with fckeditor enabled, I don't even see the button (hidden by fckeditors css)
When I reveal the button with firebug, I get the empty popup described above.
If I switch to plain text, I see the button, but still get the empty popup.

If I disable fckeditor completely, all works.

I saw some errors in the log, looking for img_assist_fckeditor.js. Following the instructions on fckeditor readme to copy that js across (as above) the errors went away, but I still only get the empty popup.

Could be fckeditor changed the way it handles fields a little bit?

I see a few code notices in my logs too

Undefined index: custom_advanced in /Library/WebServer/Documents/drupal6/sites/images/modules/modified/img_assist-DRUPAL-6--2-0-ALPHA3/img_assist.module on line 1461.
Undefined index: custom_all in /Library/WebServer/Documents/drupal6/sites/images/modules/modified/img_assist-DRUPAL-6--2-0-ALPHA3/img_assist.module on line 1458.

- probably not fatal or related, just PHP STRICT complaining.

My modules are installed in odd places and subfolders - could be an issue.

dman’s picture

Project: Image Assist » FCKeditor - WYSIWYG HTML editor

OK. I see a race condition where img_assist_fckeditor adds its scripts.

I replaced the (document level)

for (var i = 0; i < head.getElementsByTagName('script').length; i++) {
  if ( head.getElementsByTagName('script')[i].src.match( /img_assist/ ) ) {
    fckeditor_add_script(head.getElementsByTagName('script')[i].src.replace( /img_assist[_a-z]*\.js/, 'img_assist_textarea.js' ));
    break;
  }
};

with the jscript deferred init wrapper

$(document).ready( function() {
  for (var i = 0; i < head.getElementsByTagName('script').length; i++) {
    if ( head.getElementsByTagName('script')[i].src.match( /img_assist/ ) ) {
      fckeditor_add_script(head.getElementsByTagName('script')[i].src.replace( /img_assist[_a-z]*\.js/, 'img_assist_textarea.js' ));
      break;
    }
  };
})

and things now happen in the right order.

... the button is still hidden for me though...

Seeing as the fckeditor project sems to take ownership of this file, I'll bump it back there for review. Looks to me like that script needs a bit more love.

setTimeout("InitFCKeditorImgAssist();", 1000);

for example looks like a poor-mans $(document).ready also

I Imagine you'll only be seeing this condition on fast local dev machines - may not show up on remote sites.

chrisivens’s picture

This is a timing issue. When the img_assist_fckeditor.js runs it loads in the img_assist_textarea.js as shown above. This means that the getArgs function isn't available necessarily. I changed things so that the initLoader function is called with a delay.

I removed the onLoad function from the body of the popup window around line 590 of image_assist.module and added a timeout in a rather hacky way to the scripts around line 588 like so:

$output .= "<script type=\"text/javascript\"> setTimeout(\"initLoader();\", 2000);</script>";

I'd like to have the time to sort this properly but deadlines are killing me. Will try and get back on to it soon.

Jorrit’s picture

Status: Active » Closed (fixed)

Please see #520706: Security update 6.x-2.0-alpha4 breaks FCKEditor 6.x-2.0-beta1. The loading mechanism has completely changed in 2.x-dev, please download it and try it.