When you update an image style, you need to clear your browser cache in order to see the updated image style take effect. There may be cases that you need to update the image ASAP and you can't rely on users clearing their browser cache.

Steps to reproduce:

  1. View Image in Safari
  2. Look at the image url: /sites/default/files/styles/river_thumbnails_teaser/public/field/image/my_image.jpg?itok=U5XXDilb
  3. In Chrome log in and update the image style
  4. Make sure to press the "Update Style" button
  5. Flush All Cache
  6. Refresh the page in Safari
  7. Look at the image url: /sites/default/files/styles/river_thumbnails_teaser/public/field/image/my_image.jpg?itok=U5XXDilb

The only way I can see the image take in effect right away is the clear my browser cache.

Do you think it would be a good idea to update the itok parameter value every time an image style is updated?

Comments

elijah lynn’s picture

Just ran into this issue because we are using Upload Replace module that will rename the new uploaded file to be the same name. The itok is generated with image_style_path_token() and will always generate the same token and the code in image_style_deliver() will always check the itok with the same algorithm for incoming image derivative generation requests.

So the logical option of having the itok param change is not that realistic and it would appear that the only option if we are using the same file name is to use Cache-control headers and pass a no-store along to the browser for those images.

Or maybe add a second query param onto the image to bust the cache...

elijah lynn’s picture

Version: 7.34 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

plach’s picture

Status: Active » Closed (duplicate)
Related issues: +#2884203: Invalidate client-side cache when image style is modified.

Marking this as a duplicate of #2884203: Invalidate client-side cache when image style is modified. as that one is more active.