Closed (fixed)
Project:
ImageCache
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Sep 2007 at 20:31 UTC
Updated:
6 Dec 2007 at 15:04 UTC
if you change the theme_imagecache function from this:
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL ) {
$attributes = drupal_attributes($attributes);
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
return '<img src="'. $imagecache_path .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
}
to this:
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL ) {
$attributes = drupal_attributes($attributes);
if(!file_exists(file_create_path('imagecache/'.$namespace.'/'.$path)) && variable_get('clean_url', 0) == 0) {
$imagecache_path = 'http://'.$_SERVER['HTTP_HOST'].base_path().'?q='.file_directory_path() .'/imagecache/'. $namespace .'/'. $path;
} else {
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
}
return '<img src="'. $imagecache_path .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
}
you will have the imagecache working also without the clean URL.. nice no? :)
Comments
Comment #1
jpetso commentedNice little hack, but please don't set your own patches to "ready to be committed" except for the most straightforward, bug fixing one-liners. That's the task of reviewers that are trusted by the module maintainers.
Comment #2
ademarco commented...you're right, I'll follow your advise next time... bye! :)
Comment #3
jpetso commentedResetting the issue title. I don't know whether it should be left open or not, though.
Comment #4
dopry commentedFrankly I'm strongly of the opinion you shouldn't be using imagecache without clean url support... It kind of violates the idea of using it for public files... while It has the same performance impact as private files + imagecache...
However if you want me to consider this submit it as a proper patch...
http://drupal.org/patch/create
Comment #5
dopry commented