You are here

function epsacrop_crop_private in EPSA Crop - Image Cropping 6.2

Same name and namespace in other branches
  1. 6 epsacrop.module \epsacrop_crop_private()

callback for handling private files imagecache requests

1 string reference to 'epsacrop_crop_private'
epsacrop_menu_alter in ./epsacrop.module
Implementation of hook_menu_alter

File

./epsacrop.module, line 387
The main file of module

Code

function epsacrop_crop_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))) {
    _epsacrop_crop($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;
  }
}