Any way to add imce support?

Comments

Jkello’s picture

I suppose IMCE is supported. No?

Steve Lockwood’s picture

I'm not familiar with IMCE and how it fits in with TinyMCE. I presume it lets you directly insert images/files into a document - but I haven't tried it.

I will take a look.

Steve

ass45sin’s picture

Version: 6.x-1.2 » 5.x-1.0

I'd be great if the 5.x version could also support IMCE for image / file browsing and image insertion capabilities.

encho’s picture

I am not a module developer, but maybe this helps getting it integrated - this is what I enter in template.php in order to make tinymce working with IMCE:

function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
  static $access, $integrated;

  if (!isset($access)) {
    $access = function_exists('imce_access') && imce_access();
  }

  $init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running);

  if ($init && $access) {
    $init['file_browser_callback'] = 'imceImageBrowser';
    if (!isset($integrated)) {
      $integrated = TRUE;
      drupal_add_js("function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');
    }
  }

Hope this helps, I really prefer this module to another, so maybe someone can fix this code / integrate it to the module. The way it works is that it creates additional 'insert image' icon, which is available after 'url' in the pop-up. Then it pops-up IMCE's browser.

Steve Lockwood’s picture

That's very helpful encho - I will have a go at this soon.

Steve

fred0’s picture

Version: 5.x-1.0 » 6.x-1.5

I just got this working on Drupal 6.2 and TinyTinyMCE 1.5:

Edit tinytinymce.module and add to the end:

drupal_add_js("function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');

Then in the TinyTinyMCE admin page, in the init script box, add after elements: "edit-body",:

file_browser_callback: "imceImageBrowser",

Steve Lockwood’s picture

My first attempt at integrating IMCE will be posted as a version 6 development snapshot shortly (25/6/2008).

It seems to work but I have to admit I haven't tried Fred0's suggestion above, which looks a lot simpler. So will also take a look at that.

Steve

Steve Lockwood’s picture

Fred0's code is much better than mine (thanks Fred0 and sorry for taking so long for the penny to drop). So I have created a new release 6.x.1.7 which incorporates it with just a minor mod so it detects whether IMCE is present.

Steve

Steve Lockwood’s picture

Status: Active » Fixed
Steve Lockwood’s picture

Version: 6.x-1.5 » 5.x-1.2
Status: Fixed » Active

Reopening so I remember to do the same for V5.

jeffsensat’s picture

Hey Steve —

IMCE button now shows up! Thanks.

With Safari 3.1.1 (also Firefox 3.0), Mac OS X 10.5.3, Drupal 6.2, IMCE 1.0 and TTMCE 6.x_1.7 I get no image previews once the IMCE window launches. Clicking on any image normally shows that image’s preview in the lower pane of the IMCE window.

Steve Lockwood’s picture

Hi jeffsensat - It might be worth posting this issue in the IMCE project.

Do you get the same problem if you access IMCE directly without going through TinyTinyMCE or TinyMCE? Ie go to "My account" then the "file browser" tab.

I'm using Firefox 3 on Windows (which works fine) so presumably you are referring to Firefox 3 on Mac?

Steve

jeffsensat’s picture

Do you get the same problem if you access IMCE directly without going through TinyTinyMCE or TinyMCE? Ie go to "My account" then the "file browser" tab ... I'm using Firefox 3 on Windows (which works fine) so presumably you are referring to Firefox 3 on Mac?

Just checked it, Steve ... and YES, I get the same behavior whether accessing the File Browser alone or within either TinyMCE or TinyTinyMCE.

Affirmative: I’m on a Mac. And, IMCE exhibits the same behavior with Safari 3.1.1 and Firefox 3.0

So, I guess it’s not a TMCE or TTMCE prob, eh? Thanks for the troubleshooting idea.

Steve Lockwood’s picture

Status: Active » Fixed

Thanks for letting me know - I'll close this thread as it looks as though the problem is within IMCE itself.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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