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?

Comments

drewish’s picture

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.

headkit’s picture

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

guardian’s picture

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

headkit’s picture

i will try that.
big thanx, man!

headkit’s picture

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!!!

headkit’s picture

no hints?

guardian’s picture

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/" directory

i would say a decision has to be taken whether or not it is safe to allow derivative files outside "files/"

fizk’s picture

Status: Active » Closed (won't fix)