You are here

function imagecache_cache_private in ImageCache 6.2

Same name and namespace in other branches
  1. 5.2 imagecache.module \imagecache_cache_private()

callback for handling private files imagecache requests

1 string reference to 'imagecache_cache_private'
imagecache_menu in ./imagecache.module
Implementation of hook_menu().

File

./imagecache.module, line 411
Dynamic image resizer and image cacher.

Code

function imagecache_cache_private() {
  $args = func_get_args();
  $preset = check_plain(array_shift($args));
  $source = implode('/', $args);
  if (user_access('view imagecache ' . $preset) && !in_array(-1, module_invoke_all('file_download', $source))) {
    _imagecache_cache($preset, $source);
  }
  else {

    // if there is a 403 image, display it.
    $accesspath = file_create_path('imagecache/' . $preset . '.403.png');
    if (is_file($accesspath)) {
      imagecache_transfer($accesspath);
      exit;
    }
    header('HTTP/1.0 403 Forbidden');
    exit;
  }
}