- Issue created by @l.soulier
Currently, the imagecache_external module allows fetching images from external sources, but there is no simple way for developers to customize this process after the imagecache_external_fetch function (line 166 in imagecache_external.module) is executed.
I propose adding an alter hook by calling \Drupal::moduleHandler()->alter('imagecache_external_fetch', $filepath); immediately after this function call, so developers can modify the behavior or parameters of image fetching, such as adjusting the file path or adding custom logic.
Example of modified code:
elseif ($filepath = imagecache_external_fetch($url, $directory . '/' . $filename)) {
\Drupal::moduleHandler()->alter('imagecache_external_fetch', $filepath);
return $filepath;
}
Why would this be useful?:
This would allow developers to easily hook into the image-fetching process and modify aspects such as the file path, add transformations, or apply additional logic (e.g., security checks or image transformations) before the image is saved or used.
It would enhance the flexibility of the module and allow for customized behavior without modifying the core module code.
Active
3.0
Code