I have a little demo of this of my camera app:
https://shielded-plains-5586.herokuapp.com/
When you press "Drop', it creates a canvas after you take a picture with a webcam below it. My problem is that I don't know how to get the canvas into an image and have it save to my database through a form with paperclip on it. I'm really stumped. could anyone help?
答案 0 :(得分:0)
使用canvas.toDataURL()
,将返回图像数据URI。
将其发布到您需要编写文件的服务器并将路径保存在数据库中。
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData