You are here

function hook_imagecache_external_directory_alter in Imagecache External 7.2

Add possibility to alter the directory.

Use this hook to change the folder the images are stored in.

1 invocation of hook_imagecache_external_directory_alter()
imagecache_external_generate_path in ./imagecache_external.module
Util to generate a path to an image.

File

./imagecache_external.api.php, line 25
Documentation of Imagecache External hooks.

Code

function hook_imagecache_external_directory_alter(&$directory, $filename, $url) {

  // Example: create subfolders for the first two characters of the filename.
  $regex = '#(\\w\\w)#';
  preg_match($regex, $filename, $matches);
  if (!empty($matches[1])) {
    $directory = $directory . "/" . $matches[1];
  }
}