Reputation: 251
I have developed a cordova app where I'm using Cordova camera plugin(https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html) for taking images from the phone via camera or gallery and crop according to a fixed frame size to save on the server. But when the user selects an image from the gallery the cropping tool not working for certain phones like phones of Redmi Note 4, Redmi Note 3, Redmi 3S Prime, LeTv phones though I have given "allowEdit:true".
JS Code:-
navigator.camera.getPicture(uploadPhoto, function(message) {
}, {
//quality: 99,
quality: 25,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: true,
targetWidth: 0,
targetHeight: 0
});
How should I go ahead to solve this cropping issue?
Upvotes: 2
Views: 2236
Reputation: 53301
From the docs
allowEdit is unpredictable on Android and it should not be used! The Android implementation of this plugin tries to find and use an application on the user's device to do image cropping. The plugin has no control over what application the user selects to perform the image cropping and it is very possible that the user could choose an incompatible option and cause the plugin to fail. This sometimes works because most devices come with an application that handles cropping in a way that is compatible with this plugin (Google Plus Photos), but it is unwise to rely on that being the case. If image editing is essential to your application, consider seeking a third party library or plugin that provides its own image editing utility for a more robust solution.
So, basically don't use it as it's not guaranteed to work as it needs an external app to do the crop and not all devices will have it.
Upvotes: 2