I am using Rmagick in my photo sharing application and Its working properly , but while editing the picture ,my original picture get lost, I can't RESET the original picture , my code is given below .
image = Magick::ImageList.new("public/"+ @upload.public_filename(:org))
# image = image.colorize(0.30,0.30,0.30,"orange")
if params[:method] == "rotateacw"
image = image.rotate(-90)
elsif params[:method] == "rotatecw"
image = image.rotate(90)
elsif params[:method] == "black&white"
image = image.quantize(256, Magick::GRAYColorspace)
elsif params[:method] == "polaroid"
image = Magick::Image.read("public/"+ @upload.public_filename).first
cols, rows = image.columns, image.rows
image[:caption] = params[:polaroid_text].to_s
image = image.polaroid {self.gravity = Magick::CenterGravity }
image.change_geometry!("#{cols}x#{rows}") do |ncols, nrows, img|
img.resize!(ncols, nrows)
end
image.write("public/" + @upload.public_filename(:org))
i want to have some code in the controller side , like Reset the same image , please help me out get original picture back ?