Reputation: 1102
I'm using rmagick to rotate my picture. So, basically when testing, after I invoked the rotate function and it executed successfully. I need to refresh the browser to see the result. That's normal.
So here come the question: when I move to controller method, after I invoked the function and make a redirect_to, it don't display the correct rotated picture. In case, I have to refresh my browser again to see the result. What possible that caused this issues?
my controller function is something like this:
def update
@pic = Photo.find(params[:id]
@pic.rotate_direction(90)
redirect_to edit_photo_path(@pic)
end
My rotation function is working well. I suspect that caching is the problem, but when I use browser that don't save cache,it still remain the same result. Anyone faces this issues?
Upvotes: 1
Views: 491
Reputation: 951
require 'RMagick'
def rotate
photo = Photo.find(params[:id])
image = Magick::ImageList.new(photo.file)
image = image.rotate(90)
image.write(photo.file)
end
Upvotes: 2