On Drupal 7, I have added a drupal_alter on the image_style_url file in order to be able to remove itoks. My idea was to offer a hook that allow to alter the image styled url without modifying the original behavior of the image module.
As a file_url_alter hook (thrown by the file_create_url function) exists and, on the image_style_url function, the unique action made after the file_create_url call is the add of the itok, the main aim of my new hook is to offer the ablility of itok's removal.
With that call of Drupal alter, just create a module that catch my new hook and remove the itok :
function itok_fix_image_style_url_alter(&$file_url){
if(strstr($file_url, '?itok=') != FALSE){
$exploded_itok = explode('?itok=', $file_url);
$file_url = $exploded_itok[0];
}
}
Comment | File | Size | Author |
---|---|---|---|
image-alter-image-url_1.patch | 629 bytes | julien_g | |
Comments
Comment #1
tstoecklerThis needs benchmarks to measure the performance hit this would cause.
Also re-titling, as the itok removal is being handled in #1934498: Allow the image style 'itok' token to be suppressed in image derivative URLs and it seems that has good chance of hitting core.
Comment #2
julien_g CreditAttribution: julien_g as a volunteer commented