I want to save the image from the ios app to the image gallery so that the user can share it.
My application uses ionic structure and ngCordova. I am trying to save the image as follows:
image = cordova.file.applicationDirectory + "www/img/deck/" + card.image; file_path = cordova.file.documentsDirectory + "wisdom.png"; $cordovaFile.createFile(file_path, true).then(function(result) { alert(JSON.stringify(result)); }, function(err) { alert('create error: ' + JSON.stringify(err)); }); $cordovaFile.writeFile(file_path, image).then(function(result) { alert(JSON.stringify(result)); }, function(error) { alert(JSON.stringify(err)); });
This gives error code 5, ENCODING_ERR - when creating the file. Record file does not give success or error with error. There is no image in the gallery. What should be the path to save the file? How to send image to recording method? Why am I getting a coding error?
source share