문제

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.

도움이 되었습니까?

해결책

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}" %>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top