Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Problem when image is stored on device (Android) #28

Open
jonasrod opened this issue Feb 11, 2016 · 5 comments
Open

Problem when image is stored on device (Android) #28

jonasrod opened this issue Feb 11, 2016 · 5 comments

Comments

@jonasrod
Copy link

When I select an image from gallery in android, cause app crash, or when I use cordova camera plugin and set savetophotoalbum, it's cause the same problem.

@jonasrod jonasrod changed the title Problem when image was stored in device (Android) Problem when image was stored on device (Android) Feb 11, 2016
@jonasrod jonasrod changed the title Problem when image was stored on device (Android) Problem when image is stored on device (Android) Feb 11, 2016
@Heshyo
Copy link

Heshyo commented Feb 11, 2016

Can you do a logcat to check the kind of exception you get? OutOfMemoryException is quite common when handling large images on Android. Maybe you can try importing a very small image.

@RaananW
Copy link
Owner

RaananW commented Feb 11, 2016

I assume you are using the base 64 variant? as Heshyo said, this could happen due to lack of memory. What device are you using? what is the image size?

@jonasrod
Copy link
Author

@Heshyo I don't get any exception in javascript console. I don't think this problem is OutOfMemoryException, because the same code works when set savetophotoalbum to false.
The problem seems to occurs just when the image is stored in the gallery.
@RaananW My device is LG G3, and the problem occur with both small image (e.g. 25k) or large image.

@RaananW
Copy link
Owner

RaananW commented Feb 11, 2016

Can you see the Java/Android log? there must be an exception thrown if the app crashes. Can you also paste the js code you are using?

@jonasrod
Copy link
Author

I didn't used the base64 variant. I changed to base64 and it works now.
But, follow my original code:

var options = {
quality: 30,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: false,
encodingType: Camera.EncodingType.JPEG,
saveToPhotoAlbum: true,
correctOrientation: true
}

$cordovaCamera.getPicture(options).then(function(imageUrl) {
console.log(imageUrl);
var imageUri = imageUrl;
var resizeOptions = {
imageDataType: ImageResizer.IMAGE_DATA_TYPE_URL,
resizeType: ImageResizer.RESIZE_TYPE_MIN_PIXEL,
storeImage: false,
photoAlbum: false,
format: ImageResizer.FORMAT_JPG
};

window.imageResizer.resizeImage(function(data) {
FileService.storeImage("data:image/jpeg;base64," + data.imageData);
resolve();
}, function (error) {
console.log("Error : \r\n" + error);
}, imageUri, 200, 0, resizeOptions);

The code above don't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants