-
Notifications
You must be signed in to change notification settings - Fork 94
-
Hello,
I'm using exportImage('png') to export the drawing, and pass the data to my server via an ajax call to save the file for later viewing.
<button onClick={() => { canvasRef.current .exportImage("png") .then((data) => { saveDrawing(somedata1, somedata2, data); }) .catch((e) => { console.log(e); }); }} > Save Drawing </button>
I want to re-import the image back into the canvas, but i cant seem to find a way.
I can do this with a basic html canvas
` const canvas = document.getElementById('drawingCanvas');
const context = canvas.getContext('2d');
drawing = new Image();
drawing.src = "PATH_TO_IMAGE.PNG";
drawing.onload = function() {
context.drawImage(drawing, 0, 0);
};`
How can i achieve this using this component?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment