This is forked from halloland/cordova-plugin-image-resizer (which is forked from the original JoschkaSchulz/cordova-plugin-image-resizer) to address the following issues:
- only synchronous resizing (thanks to halloland for providing async handling)
- possible confliciting permission with other plugins (removed config-file entry for Android WRITE_EXTERNAL_STORAGE permission)
DISCLAIMER: this repo is only for the above mentioned one-time enhancements! it will not be under further development, see original attention note below!
I don't have any time to maintain this plugin anymore. As long as no one wants to maintain it I don't see the possiblity to fix all the stuff mentioned in the issues, sorry. I recommend to not use this plugin anymore.
By: Protonet GmbH
Authors: Joschka Schulz
Use the Cordova CLI and type in the following command:
// This plugin uses the cordova-plugin-camera
cordova plugin add cordova-plugin-camera
// This plugin
cordova plugin add https://github.com/protonet/cordova-plugin-image-resizer.git
At the moment the plugin is available on android, iOS and windows
window.ImageResizer.resize(options, success, failed);
- uri(String): The Uri for the image on the device to get scaled (can be file:// path (iOS,Android) or data:image base64 encoded string(Android only))
- folderName(String): The name of the folder the image should be put in android only
- fileName(String): A custom name for the file. Default name is a timestamp. android and windows only
- quality(Number): Quality given as Number for the quality of the new image - defaults to 85 android and iOS only
- width(Number): The width of the new image,
- height(Number): The height of the new image
- base64(Boolean): Whether or not to return a base64 encoded image string instead of the path to the resized image
- fit(Boolean): Whether or not to fit image in bounds defined by width and height android only
var options = {
uri: uri,
folderName: "Protonet Messenger",
quality: 90,
width: 1280,
height: 1280,
base64: true,
fit: false
};
window.ImageResizer.resize(options,
function(image) {
// success: image is the new resized image
}, function() {
// failed: grumpy cat likes this function
});