There is an issue caused by external caching.
Drupal's default .htaccess sets asset caching to 14 days.
When a change is made to an existing image, such as changing the focus or crop, the changes are saved and visible to requests to origin. However, external caches such as a CDN or Varnish still maintain the stale copy of the image until the 14 day TTL expires.
A solution could be to add the config options to the image URL. This could either change the image name such that example.jpg becomes example.jpg?itok=xxxxxx&f=300x200_400x300.jpg or something to this effect. This would cause the browser to request what looks like a completely new asset.
Comments
Comment #1
erikwebb commented#1032666: Previewing can show stale images
Comment #2
anrikun commentedI understand that this can be a problem but it is not a bug. AFAIK there is no Drupal way to alter an image style URL. See
image_style_url()If you find one, please feel free to post a patch.
There might be other solutions to support external caching but again I don't think that it is possible to change an image URL on focus/crop change.
Comment #3
erikwebb commentedhttps://api.drupal.org/api/drupal/modules!system!system.api.php/function...
Comment #4
cashwilliams commentedTried using hook_file_url_alter() to append a cache buster of some sort, but image_style_url() expects a clean $uri because it runs it though file_create_url() which encodes the parameter making it a broken url.
Closing won't fix.