imagecache folder and files outside the drupal installation path
headkit - June 26, 2008 - 17:30
| Project: | ImageCache |
| Version: | 5.x-2.0 |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | headkit |
| Status: | active |
Jump to:
Description
hi!
i try to make imagecache save its generated files outside the drupal installation path.
i changed the system files path to "../" and i changed the imagecache file path with a theming function in template.php like
function blackborder_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
$attributes = drupal_attributes($attributes);
if (module_exists('transliteration')){
$pathlength = strlen(file_directory_path());
$splitted = substr(transliteration_get($path), $pathlength);
$imagecache_path = file_create_url(file_directory_path().'/imagecache/'. $namespace .$splitted);
}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 .' />';
}but how could i make imagecache write its files to this path?
"../files/imagecache/namespace/images/"
can someone help me?

#1
imagecache isn't designed to write it's files outside of drupal's files directory. i don't think you're going to be able to get it to work without some hacking.
#2
i would be fine with that.
but at which end shoul i hack the module. i don't find the code which starts the filecreation...
#3
i offered a patch allowing to change the path where imagecache stores the derivatives: http://drupal.org/node/251597
the first version of the patch allowed to stored files anywhere
then another version was made in order to comply with http://drupal.org/node/66763
however in the end, it is still undecided whether or not imagecache should be allowed to store the derivatives anywhere; according to dopry nothing forbids it
#4
i will try that.
big thanx, man!
#5
o.k. which one exactly allows a path leading to anywhere?
i tried the latest of your patches from that link and i can change the path of imagecache now. thats nice and it creates the imagecache folder outside the installationpath of drupal, but it does not create a preset-folder and no image file.
please help,
thnx!!!
#6
no hints?
#7
the patch attache to this comment: http://drupal.org/node/251597#comment-822602 used to offer the functionality you need
however, since then, imagecache's code evolved and the patch doesn't apply anymore
the patch attached to http://drupal.org/node/251597#comment-866944 is more recent and may still apply but it forces the derivative files to be under the
"files/"directoryi would say a decision has to be taken whether or not it is safe to allow derivative files outside
"files/"