Is it possible to store the the canvas image to device library using phonegap FILE API
Asked
Active
Viewed 1,151 times
0
-
[Refer for storage limitations](http://stackoverflow.com/questions/20419574/saving-dataurlbase64-to-file-on-phonegap-android) and [Refer this for Plugin to convert Base64 to File](http://stackoverflow.com/questions/11388018/phonegap-plugin-to-convert-base64-string-to-a-png-image-in-android) then you continue with [phonegap file plugin](https://github.com/apache/cordova-plugin-file) – Manjesh V Jul 23 '14 at 04:22
-
will it store the image in photo library? – Mohamed Samsudeen Jul 23 '14 at 05:54
1 Answers
0
Yes,
var canvas = document.getElementById('myCanvas');
// Draw your canvas here
//...
var dataURL = canvas.toDataURL(); // getting base64 string
Once you got the base64 string set up the phonegap plugin for converting base64 image string to png or jpg file
the above mentioned plugin automatically store image to /sdcard/Pictures
window.plugins.base64ToPNG.saveImage(myBase64, {filename:"dot.png", overwrite: true},