Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not quite sure what you mean bye "other side" and "native language".</p> <p>But, you can send canvas images to a server using AJAX.</p> <p>The server receives the canvas image as base64 encoded image data.</p> <p>For example, assume:</p> <ol> <li><p>You’re sending the image to a php server (yourOtherSide.php) – but of course this could be any server that accepts ajax posts.</p></li> <li><p>You have a reference to the canvas element holding your frame: canvas</p></li> <li><p>Your ajax payload contains an id number of the frame being sent (ID) and the image data (imgData).</p></li> <li><p>(optionally) You are getting some response back from the server—even if it’s just “OK”: anyReturnedStuff</p></li> </ol> <p>Then your ajax post would be:</p> <pre><code>$.post(“yourOtherSide.php”, { ID:yourFrame ID, imgData: canvas.toDataURL(‘image/jpeg’) }) .done( function(anyReturnedStuff){ console.log(anyReturnedStuff); } ); </code></pre> <p><strong>[Edited to include server-side creation of images from the ajax post]</strong></p> <p>These code samples will receive the ajax base64 imageData and create an image for you to process with your c-image-processing-library.</p> <p>If your're using a PHP server:</p> <pre><code>$img = imagecreatefromstring(base64_decode($imageData)); // and process $img with your image library here </code></pre> <p>or if you're using asp.net:</p> <pre><code>byte[] byteArray = System.Convert.FromBase64String(imageData); Image image; using(MemoryStream s=new MemoryStream(byteArray){ image=Image.FromStream(ms); // and process image with your image library here } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload