Question

I am using the image created from this jsfiddle http://jsfiddle.net/26Ws4/7/ and pass the image created from here to the database or a folder on the server(using paperclip).

In jsfiddle the img is initially created on the canvas and then to an img tag

<div class="canvas-wrap clearfix">
    <canvas id="canvas" height="700" width="700"></canvas>
</div>

Even if I use forms how to transfer the img to database/folder.

I am new to ruby on rails,the index page is the one in the jsfiddle.

Était-ce utile?

La solution

I have limited knowledge on this subject, but I believe you're dealing with an HTML5 canvas object -- which creates SVG-type graphics on the fly


HTML5 Canvas != Image

In order to transfer between the two, I would look to convert the HTML5 canvas render into an image object through Rails

I don't know anything about how to do this, but this tutorial does


Paperclip

To transfer into Paperclip, I would do this:

  1. Transfer the Canvas render into an image (JS)
  2. Send the image to Rails (Paperclip)
  3. Use Paperclip to save the new record

I can write some code for this if you want, but it won't be tested or pretty

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top