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

erikwebb’s picture

Priority: Normal » Major
anrikun’s picture

Title: Image URL should change when focus/crop changes » Add support for external caching
Category: Bug report » Feature request

I 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.

cashwilliams’s picture

Status: Active » Closed (won't fix)

Tried 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.