function file_aliases_file_url_alter in File Aliases 7
Implements hook_file_url_alter().
Parameters
$uri:
File
- ./
file_aliases.module, line 90 - Contains core functions for the File Aliases module.
Code
function file_aliases_file_url_alter(&$uri) {
$fid = db_select('file_managed', 'f')
->fields('f', array(
'fid',
))
->condition('uri', $uri)
->execute()
->fetchField();
if ($fid) {
$source = "file_aliases/{$fid}";
if (($alias = drupal_get_path_alias($source)) != $source) {
$uri = url($alias, array(
'absolute' => TRUE,
));
}
}
}