By harsha012 on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
8.5.x
Issue links:
Description:
Now modules are able to alter the image style derivative generated URI, by implementing the new hook hook_image_style_uri_alter().
In the next example, the mymodule module, implements this hook to change the scheme of a derivative from private:// to public://:
function mymodule_image_style_uri_alter() {
$name = $context['image_style']->id();
if ($name === 'watermarked_low_resolution') {
$path = $context['path'];
// Low resolution, watermarked images are available publicly, in the
// public:// stream wrapper.
$uri = "public://styles/$name/public/$path";
}
}
Impacts:
Module developers