Issue
I have been trying for a few days now to take an image from the Canvas of my application and save that to the device... I've tried some (with no result) plugins like: Save2Canvas, Base64 To Gallery, Canvas2ImagePlugin and Cordova base64ToGallery Plugin...
I am using:
Cordova 7.0.1
Ionic 1.x
Right now the part of my Js. function to save is like this
var image = canvas
.toDataURL("image/png");
window.location.href=image;
Which kind of works on ionic 1.x via browser but not on the device...
Solution
Try this using canvas2ImagePlugin(that you mentioned). This worked for me for saving my canvas content to gallery.
<canvas id="myCanvas" width="165px" height="145px" ></canvas>
<script>
//get the canvas element
var canvas = document.querySelector('canvas');
//save to Gallery
window.canvas2ImagePlugin.saveImageDataToLibrary(
function(msg){
console.log(msg);
},
function(err){
console.log(err);
},
document.getElementById('myCanvas')
);
</script>
Answered By - pro_cheats
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.