IMCE integration
| Project: | Tiny Tiny MCE |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Steve Lockwood |
| Status: | needs work |
Hi, I am having trouble with IMCE integration in 5*
as instructed in previous posts about this issue....
I added the following code to the Tiny Tiny Module:
/**
* IMCE Integration
*
* Adds the scripts necessary for imce integration
*/
function tinytinymce_imce () {
drupal_add_js("
function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=Editor|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');
}
then I added:
file_browser_callback: "imceImageBrowser",
to the settings in the admin page
So far I have the browser button showing up fine but it doesn't bring up the window to let you browse and select an image.
Any help would be appreciated.
I have it all working fine in 6* but need to use 5* for this particular project due to other modules in use.
Thanks in advance

#1
Hi fibie,
What I think may be missing is the call to the function tinytinymce_imce (). Ie you have defined it but it has not been called.
In the D6 version of function tinytinymce_theme_textarea($value), you will see that we detect whether IMCE is present and, if so, we call function tinytinymce_imce ().
You should be able to tell whether it is working by looking at the source HTML for your page - it should contain the added function:
function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=Editor|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');I hope this helps. If you get it working, please send me the code!
Steve
#2
I have made some changes which get a little closer but does not completely solve the problem. (And I realise that my previous post was off the mark - you'd got a bit further than I thought.)
D5 does not support the "Drupal.settings.basePath" object - I got round this by simply changing it to
function tinytinymce_imce () {drupal_add_js("
function imceImageBrowser(fid, url, type, win) {win.open('/?q=imce&app=Editor|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');
}
This gets a little further - it will open the IMCE file browser. The trouble is I can't see how to get the file browser to return a value to TinyMCE - all it lets you do is upload, delete resize etc. I think the string which invokes IMCE (?q=imce&app=Editor|url ....) is not compatible with the D5 version of IMCE but I don't know what it should be.
Can anyone suggest anything?
Steve
#3
Hi Steve,
Thanks for where you have got too so far.
I tried changing the code to what you suggest but it still doesn't work for me - still nothing when I click the browse button.
Are you saying it now opens the new window for you?
Thanks again for your help
Fibie
#4
Ok finaly it works for me :) Your module is great and i hope that'll help some people.
Both imce.module and tinytinymce.module included in archive.
I added some code from 6x version to 5x version for tinytinymce.module for imce, and some code to imce.module just like tinymce module integration.
If you've already installed tinytinymce module - u'll need 2 add "file_browser_callback: "imceImageBrowser"," at your init script (it's already in default for new installation)
#5
Many thanks DeathClaw - I'll take a look at your code and integrate it into my module.
Steve
#6
#7
Thanks so much guys, sorry haven't been round for much of the discussion about this after having raised the issue. This patch works great - really appreciate your help on this one - I had just been completely stumped.
#8
Many thanks DeathClaw, I will incorporate your patch into a new D5 version of the module (with some notes and an acknowledgement in the install.txt file). I will also post a request in the IMCE project to do the same.
Steve
#9
Automatically closed -- issue fixed for two weeks with no activity.
#10
When I add images with this patched version of both modules, I can see them in the editor but after publishing they have the wrong url (should have another ../ at the front of src=).
#11
Fixed by adding "relative_urls : false," to init.
#12
Added "relative_urls : false," to init, but still not able to view the image & file when the page is published.
#13
I added "relative_urls : false," to init in tinytinymce admin settings but still not able to view the uploaded image when the page is published. the url for the uploaded image is .../.../files/images, but if the url is files/images only then the uploaded image is displayed when the page is published. I'm not knowing how to remov the ..../.../ before the files/images in the uploaded image url. Please help.
Thanks.