1

Topic: Wrong directory loaded for selected image

I'm using MCImageManager along with TinyMCE.  If I already have an image in the wysiwyg and I click the file browser from the image properties, it doesn't load the subdirectory that the image is in, but loads the main directory instead (which in our case is really slow).

I did actually come up with a workaround for this by changing the pages/im/js/imagemanager.js file.  I added a fixPath function which I call before the listFiles RPC.exec:

fixPath: function() {
    if (this.path == "{default}" && this.inputURL !== undefined) {
        this.path = this.inputURL.replace("/assets/images", "{0}");
    }
}

This seems to work but is a horrible hack that I wish I could do without.  Mainly I'm concerned about having to preserve this change if we want to upgrade in the future.


I suspect that this has something to do with the fact that the images are in an IIS virtual directory, though I can't be sure.  I had a devil of a time getting the right web.config settings so that it worked with the virtual directory.  My root path is this:

<add key="filesystem.rootpath" value="../../../../assets/images" />

I.e. a relative path to the directory on the file system ("assets" is the virtual directory).  The strangest thing is what I had to set preview.urlprefix to:

<add key="preview.urlprefix" value="/ass" />

Without that, the preview url started with ets/images.

Anyway, looking for any insight into these issues and suggestions for more elegant workarounds.

2

Re: Wrong directory loaded for selected image

Yes, it's not possible to reverse resolve URLs all the time to absolute file system urls. However the upcoming 4.0 version will enable a plugin to override the URL resolving logic so you can have that hack in there until we release that and then write your own custom plugin if you want to work in another way than the default behavior.

Best regards,
Spocke - Main developer of TinyMCE