Closed razwasserstein closed 9 years ago
Hi Doron,
I am currently not maintaining the code. I will find the time in the near future to update everything and make sure this plugin can be used with the newest phonegap/cordova version. I keep this issue open and will update here as soon as I made some progress.
Best, Raanan
BTW - I believe the latest pull request solved this problem, please let me know if that was the problem!
I tried the latest version on Android and it works perfectly with storeImage = true
. I pass a native URL as argument (ie something like file:///storage/sdcard0/projectName/img/2015/01/06/imgName.jpg
)
I do have one issue on Android with the default values though:
In imageresize.js:
storeImage: (typeof options.storeImage !== "undefined") ? options.storeImage : 0,
pixelDensity: (typeof options.pixelDensity !== "undefined") ? options.pixelDensity : 1,
In ImageResizePlugin.java
if (params.getBoolean("storeImage")) {}
if (params.getBoolean("pixelDensity")) {}
It's complaining about not being able to convert 0 or 1 into a boolean. I fixed it by specifying true of false for both options. I don't know about iOS, but it'd be best to have correct default values.
I have the same issue... it should be true/false instead of 0/1, right?
changed them from
var params = {
data: imageData,
width: width ? width : 0,
height: height ? height : 0,
format: options.format ? options.format : ImageResizer.FORMAT_JPG,
imageDataType: options.imageType ? options.imageType : ImageResizer.IMAGE_DATA_TYPE_URL,
resizeType: options.resizeType ? options.resizeType : ImageResizer.RESIZE_TYPE_MAX_PIXEL,
quality: options.quality ? options.quality : 75,
storeImage: (typeof options.storeImage !== "undefined") ? options.storeImage : 0,
pixelDensity: (typeof options.pixelDensity !== "undefined") ? options.pixelDensity : 1,
directory: options.directory ? options.directory : "",
filename: options.filename ? options.filename : "",
photoAlbum: (typeof options.photoAlbum !== "undefined") ? options.photoAlbum : 0
};
to
var params = {
data: imageData,
width: width ? width : 0,
height: height ? height : 0,
format: options.format ? options.format : ImageResizer.FORMAT_JPG,
imageDataType: options.imageType ? options.imageType : ImageResizer.IMAGE_DATA_TYPE_URL,
resizeType: options.resizeType ? options.resizeType : ImageResizer.RESIZE_TYPE_MAX_PIXEL,
quality: options.quality ? options.quality : 75,
storeImage: (typeof options.storeImage !== "undefined") ? options.storeImage : false,
pixelDensity: (typeof options.pixelDensity !== "undefined") ? options.pixelDensity : true,
directory: options.directory ? options.directory : "",
filename: options.filename ? options.filename : "",
photoAlbum: (typeof options.photoAlbum !== "undefined") ? options.photoAlbum : false
};
and it seems to be working well.
before that I was getting Value 1 at pixelDensity of type java.lang.Integer cannot be converted to boolean
errors on android. I haven't tested iOS yet.
I was under the impression that the last pull twist actually fixed it. I still haven't got the chance to test it thoroughly. Sadly other things on the agenda keep me occupied :-)
Yes using a boolean should work on iOS too:
bool storeImage = [[options objectForKey:@"storeImage"] boolValue];
bool accountForPixelDensity = [[options objectForKey:@"pixelDensity"] boolValue];
@tslater if you test on iOS please tell us if the rest works, because I had to modify some things for the plugin to work.
I have updated the js file to send boolean values instead of numbers - https://github.com/RaananW/PhoneGap-Image-Resizer/commit/0b4fa1ec98ffa75371a5dbb3cb091c4908307e09 Should be working correctly now.
Hi,
When resizing an image with a file uri as a result (and not base64) the app CRASHES. I have tried numerous options for the options.directory, and options.filename.. none worked. Eventually the result was the same - CRASH.
What am I doing wrong? Is there a sample of a file uri as a result somewhere?
Thanks, Doron