Question

In my rails application I have a feature that allows users to rotate their uploaded images. On the backend I'm simply using ImageMagick's convert to rotate the image.

The problem I have is with the image_tag helper. As I understand it, image_tag adds a timestamp to the end of the file path to aid with browser caching. However, the timestamp isn't changing after applying convert and refreshing the page, so the user doesn't see any change in their image.

I'm thinking this has something to do with the entire view being cached by rails? I'm not sure if that is the case and some time spent on Google didn't really make it clear if that could be the problem.

Was it helpful?

Solution

You should be able to make the URL to the image unique for each page load, which would bust the browser cache:

<%= image_tag "name_of_image.png?#{Time.now.to_f}" %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top