Login

Contact

You can leave a message using the contact form below.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

ImageCache does not work when switched off "clean url"

Hide all descriptions
Error description: 

Error occurs when installing the module ImageCache If there'sa "cleaner url." The image is not generated.

To resolve this problem would have to edit the file imagecache.module, to do so, open it in the editor and look for the function:

<?php
function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) {
 
$path = _imagecache_strip_file_directory($filepath);
  if (
module_exists('transliteration')) {
   
$path = transliteration_get($path);
  }

 
$args = array('absolute' => TRUE, 'query' => empty($bypass_browser_cache) ? NULL : time());
  switch (
variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case
FILE_DOWNLOADS_PUBLIC:
      return
url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
    case
FILE_DOWNLOADS_PRIVATE:
      return
url('system/files/imagecache/'. $presetname .'/'. $path, $args);
  }
}
?>

Then replace it with a corrected function:

<?php
function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) {
 
$path = _imagecache_strip_file_directory($filepath);
  if (
module_exists('transliteration')) {
   
$path = transliteration_get($path);
  }

 
$args = array('absolute' => TRUE, 'query' => empty($bypass_browser_cache) ? NULL : time());
  switch (
variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case
FILE_DOWNLOADS_PUBLIC:
      if(
variable_get('clean_url', 0) ) { 
        return
url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args) ;
      } else {
        return
url($GLOBALS['base_url'] . '/index.php?q=' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
      }
    case
FILE_DOWNLOADS_PRIVATE:
      return
url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
  }
}
?>