Difference between revisions of "IMCE Fix"

From WolfTech
Jump to navigation Jump to search
Line 9: Line 9:
 
$temp = tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE
 
$temp = tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE
 
</pre>
 
</pre>
 +
 +
Additionally:
 +
 +
*add this function to your current theme's template.php file.(create it if you don't have it. make sure it has <?php at the beginning.)
 +
<pre>     
 +
<?php
 +
      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');
 +
          }
 +
        }
 +
 +
        return $init;
 +
      }
 +
      ?>
 +
</pre>
 +
*Go to admin/settings/performance and Clear cached data (at the bottom).
 +
*Make sure your users have access to IMCE (admin/settings/imce)
 +
*Clear your browser's cache and start testing.
 +
*In case of a failure, try alternative themes or browsers and report back with details.

Revision as of 09:41, 18 December 2008

To allow IMCE to work on Drupal 6 on the Engineering Servers, you need to replace the following in modules/imce/inc/page.inc (line 467):

$temp = tempnam(realpath(file_directory_temp()), 'imc');

with:

//$temp = tempnam(realpath(file_directory_temp()), 'imc');
$temp = tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE

Additionally:

  • add this function to your current theme's template.php file.(create it if you don't have it. make sure it has <?php at the beginning.)
      
<?php
      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');
          }
        }

        return $init;
      }
      ?>
  • Go to admin/settings/performance and Clear cached data (at the bottom).
  • Make sure your users have access to IMCE (admin/settings/imce)
  • Clear your browser's cache and start testing.
  • In case of a failure, try alternative themes or browsers and report back with details.