How will I save data from javascript's canvas.toDataURL to an image file in ruby?
The sample code below create the image but gives an error saying the format is not recognized or damaged
require 'base64'
chart1 = params[:chart1].split(',')
image = Base64.decode64(chart1[1])
File.open("#{Rails.root}/test.png", 'wb') do|f|
f.write(image)
end
Thanks!
NOTE: Edited. This is now ok and working