You are here

function file_aliases_preprocess_image_style in File Aliases 7

Implements hook_preprocess_image_style().

Parameters

$variables:

File

./file_aliases.module, line 39
Contains core functions for the File Aliases module.

Code

function file_aliases_preprocess_image_style(&$variables) {
  global $base_url;
  $source = drupal_lookup_path('source', str_replace($base_url . base_path(), '', $variables['path']));
  if ($source !== FALSE) {
    $fid = drupal_substr($source, 13);
    $uri = db_select('file_managed', 'f')
      ->fields('f', array(
      'uri',
    ))
      ->condition('fid', $fid)
      ->execute()
      ->fetchField();
    if ($uri) {
      $variables['path'] = $uri;
    }
  }
}