You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In production I ran into an issue where the user would see the before image after they had cropped because cropping didn't update Rails' asset id and so the browser thought it was the same image. Rather than eliminating caching for that directory in Apache or trying to tap into ActionView and sweep the asset id cache, I thought it might be better to let paperclip change the filename based on the crop settings.
In Jcropper:
self.interpolates(:crop_suffix) do |attachment, style|
target = attachment.instance
if target && (style != :original) && target.cropping?
"-#{target.crop_x.to_i}#{target.crop_y.to_i}#{target.crop_h.to_i}#{target.crop_w.to_i}"
else
""
end
end
In production I ran into an issue where the user would see the before image after they had cropped because cropping didn't update Rails' asset id and so the browser thought it was the same image. Rather than eliminating caching for that directory in Apache or trying to tap into ActionView and sweep the asset id cache, I thought it might be better to let paperclip change the filename based on the crop settings.
In Jcropper:
And in your model, add on these parameters:
At least that worked for me with Paperclip 2.4.5 and Rails 3. Sharing it here in case others run into the same problem.
The text was updated successfully, but these errors were encountered: