I encountered a problem only reproducable in IE (I tested IE6 and 8). When selecting an image in imce and pressing "Send to imceimage" Button, the Javascript insert callback function failed and IE responds:

The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute.

In imceImage.insert function I replaced the file array and used simple parameters i set before.

That produced the error

$(img).attr('src', file.url);
$(img).attr('width', file.width);
$(img).attr('height', file.height);

so I changed the whole function to

imceImage.insert = function (file, win) {
	win.close();
	furl 		= file.url;
	fwidth	= file.width;
	fheight = file.height
	fld 		= imceImage.target;
	var img = '#imceimageimg-' + fld + '-wrapper img';
        
        //only display a valid image here..
        $.ajax({
         type: 'GET',
         url: Drupal.settings.imceimage.url + furl,
         data: '',
         dataType: 'json',
         success: function(ret) {
            if(ret.validimage) {
               $(img).attr('src', furl);
               $(img).attr('width', fwidth);
               $(img).attr('height', fheight);
         
               /* form elements here. */
               $('#imceimagepath-' + fld).val(furl);
               $('#imceimagewidth-' + fld).val(fwidth);
               $('#imceimageheight-' + fld).val(fheight);
            }
            else {
               alert('not a valid image');
            }
         },
         error: function(xmlhttp) {
            alert(Drupal.ahahError(xmlhttp, Drupal.settings.imceimage.url));
         }
         });

}

That fixed the problem!

Comments

agrivas’s picture

Workaround works fine. Thanks for the tip!

igorski’s picture

great fix, thanks!

harrrrrrr’s picture

fix works indeed, but you forgot to add following line:

$('#imceimagefieldset-' + fld).show();

makbeta’s picture

Is it possible for someone to commit this fix to the latest dev version of the module?

P.S. I think this module should still be maintained and go forward, it allows users to manage files on the filesystem, something that filefield & imagefield does not do.

makbeta’s picture

Status: Active » Needs review

I've done some testing for this fix & ran into an issue, when I would select an image the full size image, instead of a thumbnail would display. The following code in this fix does this

if(ret.validimage) {
               $(img).attr('src', furl);
               $(img).attr('width', fwidth);
               $(img).attr('height', fheight);

I've updated the code to insert a thumbnail sized 80x80px (as in the original code), here's the final function that can be added into a patch

imceImage.insert = function (file, win) {
win.close();
furl = file.url;
fwidth = file.width;
fheight = file.height
fld = imceImage.target;
var img = '#imceimageimg-' + fld + '-wrapper img';
       
        //only display a valid image here..
        $.ajax({
         type: 'GET',
         url: Drupal.settings.imceimage.url + furl,
         data: '',
         dataType: 'json',
         success: function(ret) {
            if(ret.validimage) {
               $(img).attr('src', furl);
               $(img).attr('width', 80);
               $(img).attr('height', 80);
        
               /* form elements here. */
               $('#imceimagepath-' + fld).val(furl);
               $('#imceimagewidth-' + fld).val(fwidth);
               $('#imceimageheight-' + fld).val(fheight);
			   $('#imceimagefieldset-' + fld).show();
            }
            else {
               alert('not a valid image');
            }
         },
         error: function(xmlhttp) {
            alert(Drupal.ahahError(xmlhttp, Drupal.settings.imceimage.url));
         }
         });

}
AndrasAcs’s picture

The fix + comment 3 and comment 5 has worked well for us. Tx!