So i am 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;
Wich kinda works on ionic 1.x via browser but not on the device...
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.