Difference between revisions of "IMCE Fix"

From WolfTech
Jump to navigation Jump to search
Line 10: Line 10:
 
</pre>
 
</pre>
  
Additionally:
+
In includes/image.inc (line 117),
 +
 
 +
change:
 +
<pre>
 +
if (!is_file($file)) {
 +
</pre>
 +
 
 +
to:
 +
<pre>
 +
if (!@is_file($file)) {
 +
</pre>
 +
 
 +
In includes/file.inc (line 572),
 +
 
 +
change:
 +
<pre>
 +
if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {
 +
</pre>
 +
 
 +
to:
 +
<pre>
 +
if (!@move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {
 +
</pre>
 +
 
 +
 
 +
==Altering the Theme to work with IMCE==
  
 
*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.)
 
*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.)

Revision as of 10:49, 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

In includes/image.inc (line 117),

change:

if (!is_file($file)) {

to:

if (!@is_file($file)) {

In includes/file.inc (line 572),

change:

if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {

to:

if (!@move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {


Altering the Theme to work with IMCE

  • 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.