A very simple plugin for Cordova 3.x.x to save an image from a URL.
by Ronald Klip (github.com/RonaldPK)
- iOS
Through the Command-line Interface:
cordova plugin add https://github.com/RonaldPK/SaveImageFromURL.git
- Initial release.
The plugin creates the object window.plugins.saveImage
with one method:
Takes two parameters: url and a string with the name of the callback method
window.plugins.saveImage.saveImageFromURL(url, cbRef);
The plugin returns 1 on success and 0 on failure. Failure is most likely due to the app not having access to the user's Photos.
var myCallbackMethod = function(returnVal) {console.log(returnVal);}
window.plugins.saveImage.saveImageFromURL('http://www.example.com/path/to/image.png', 'myCallbackMethod');