apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
966 stars 1.55k forks source link

allowEdit : Couldn't save changes due to an error #662

Open iPMisterX opened 4 years ago

iPMisterX commented 4 years ago

Bug Report

Problem

What is expected to happen?

What does actually happen?

Screenshot_2020-09-19-15-24-00-335_com intelspire timemint

Information

Command or Code

options = {
            quality : 80,
            destinationType : Camera.DestinationType.FILE_URI,
            sourceType : Camera.PictureSourceType.CAMERA,
            encodingType: Camera.EncodingType.JPEG,
            allowEdit : true,
            targetWidth: 500
            targetHeight: 500,
            popoverOptions: CameraPopoverOptions,
            saveToPhotoAlbum: false,
            correctOrientation: true
        };

Environment, Platform, Device

Version information

Installed platforms:
  android 9.0.0
  ios 6.1.1
com.googlemaps.ios 3.9.0 "Google Maps SDK for iOS"
com.unarin.cordova.beacon 3.8.1 "Proximity Beacon Plugin"
cordova-android-firebase-gradle-release 4.0.0 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 4.0.0 "cordova-android-play-services-gradle-release"
cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-background-geolocation-lt 3.9.0 "BackgroundGeolocation"
cordova-custom-config 5.1.0 "cordova-custom-config"
cordova-plugin-advanced-http 3.0.1 "Advanced HTTP plugin"
cordova-plugin-android-permissions 1.0.2 "Permissions"
cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 2.0.0 "cordova-plugin-androidx"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 6.1.1 "CDVBackgroundFetch"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 5.0.0 "Camera"
cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-customurlscheme 4.4.0 "Custom URL scheme"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-email-composer 0.9.2 "EmailComposer"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-flashlight 3.2.0 "Flashlight"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-image-picker 1.1.1 "ImagePicker"
cordova-plugin-inappbrowser 4.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-iroot 2.0.2 "iRoot"
cordova-plugin-mock-location-checker 1.0.1 "MockLocationChecker"
cordova-plugin-multi-window 0.0.3 "cordova-plugin-multi-window"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-safariviewcontroller 1.6.0 "SafariViewController"
cordova-plugin-sign-in-with-apple 0.0.1 "cordova-plugin-sign-in-with-apple"
cordova-plugin-splashscreen 6.0.0 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-touchid 0.4.0 "Touch ID"
cordova-plugin-transport-security 0.1.2 "App Transport Security"
cordova-plugin-vibration 2.1.6 "Vibration"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-sqlite-storage 0.7.14 "Cordova sqlite storage plugin"
cordova-support-google-services 1.3.2 "cordova-support-google-services"
cordova.plugins.diagnostic 6.0.2 "Diagnostic"
phonegap-plugin-barcodescanner 8.1.1-dev "BarcodeScanner"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.3.0 "PushPlugin"
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-30,android-29,android-28,android-27,android-26,android-25,android-23,android-22,android-21
Gradle: installed /usr/local/Cellar/gradle/5.6.3/bin/gradle
Requirements check results for ios:
Apple macOS: installed darwin
Xcode: installed 11.7
ios-deploy: installed 1.9.4
CocoaPods: installed 1.10.0.beta.2
Cordova CLI: 10.0.0 
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.4 
ios-sim version: 6.1.2 
OS: macOS
Node Version: v12.18.1
Xcode version: Xcode 11.7 Build version 11E801a

Checklist

breautek commented 4 years ago

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 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.

https://github.com/apache/cordova-plugin-camera#android-quirks-1

If this only occurs with allowEdit enabled on android, then you're probably hitting one of the many uncontrollable error cases with Android.

iPMisterX commented 4 years ago

cordova-plugin-camera version 4.1.0 work normally but v5.0.0 not work :(

Hanzofm commented 3 years ago

@iPMisterX same comment.

On version 4.+ works correctly, same implementation on >=5 fails

deniscpaula commented 3 years ago

Same problem here. When allowEdit is enabled I got this error on the chrome console:

ERROR Error: Uncaught (in promise): No Image Selected
    at resolvePromise (zone-evergreen.js:798)
    at zone-evergreen.js:705
    at rejected (tslib.es6.js:71)
    at ZoneDelegate.invoke (zone-evergreen.js:364)
    at Object.onInvoke (core.js:27148)
    at ZoneDelegate.invoke (zone-evergreen.js:363)
    at Zone.run (zone-evergreen.js:123)
    at zone-evergreen.js:857
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:27136)
iPMisterX commented 3 years ago

Now i'm use cordova-plugin-crop for Crop an image after take picture

var options = {
    quality : 80,
    destinationType : Camera.DestinationType.FILE_URI,
    sourceType : Camera.PictureSourceType.CAMERA,
    encodingType: Camera.EncodingType.JPEG,
    // allowEdit : true,
    targetWidth: 500
    targetHeight: 500,
    popoverOptions: CameraPopoverOptions,
    saveToPhotoAlbum: false,
    correctOrientation: true
};

$cordovaCamera.getPicture(options).then(function(imageData) {
    plugins.crop.promise(imageData)
    .then(function success (imageCrop) {
      // Success.
      console.log('Cropped Image Path!: ' + imageCrop);
    })
    .catch(function fail (err) {
      // fail
    });
}, function(err) {
    // An error occured. Show a message to the user
});
HerickRaposo commented 3 years ago

Crop plugin worked to me but i need rectangular crop.

satyamurthy515 commented 3 years ago

Hi @all,

Any update here? for me, the allowEdit is not working in Samsung devices. Any solution for this?