You are here

function amazons3_image_style_path_alter in AmazonS3 7.2

Implements hook_image_style_path_alter().

When we are using S3, we need to rewrite image style URLs to route through our own paths.

File

./amazons3.module, line 352
Hook implementations for the AmazonS3 module.

Code

function amazons3_image_style_path_alter(&$result, $style_name, $uri) {
  $scheme = file_uri_scheme($uri);
  if ($scheme != 's3') {
    return;
  }
  $s3url = S3Url::factory($uri);
  $result = $s3url
    ->getImageStyleUrl($style_name);
}