You are here

function _protected_node_get_original_uri in Protected Node 7

Same name and namespace in other branches
  1. 1.0.x protected_node.module \_protected_node_get_original_uri()

Helper function used to return the original uri from a path and an uri.

See also

protected_node_file_download()

1 call to _protected_node_get_original_uri()
protected_node_file_download in ./protected_node.module
Implements hook_file_download().

File

./protected_node.module, line 888
Protected Node module.

Code

function _protected_node_get_original_uri($path, $uri) {
  $args = explode('/', $path);

  // Discard the first part of the path (styles).
  array_shift($args);

  // Discard the second part of the path (style_name).
  array_shift($args);

  // Discard the third part of the path (scheme).
  array_shift($args);

  // Then the remaining parts are the path to the image.
  $original_uri = file_uri_scheme($uri) . '://' . implode('/', $args);
  return $original_uri;
}