apache / cordova-plugin-camera

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

Cordova camera doesn't rotate the pic to correct orientation on Samsung phones #354

Open mgvy91107 opened 5 years ago

mgvy91107 commented 5 years ago

Hi guys, I'm building Cordova 8.0 on a Samsung cell phone with Android 5.1. I'm using cordova.pluging.camera to take a photo and upload it to a server, and then present it in an app. But the photo is uploaded to the server rotated 90 degrees and so is displayed in the application. I have tried to modify the correctOrientation option but I can not make it work. I need help to correctly configure this option, I am new to mobile application development.

Camera.js var correctOrientation = !!options.correctOrientation;

allarddehaas commented 5 years ago

@mgvy91107 Did you manage to find a fix for this? I currently have the same issue with a Samsung Galaxy J5 with Android 7.0

@janpio Do you have any info on this issue?

j3k0 commented 5 years ago

➕1️⃣

janpio commented 5 years ago

Please don't @ mention people that haven't posted in an issue before @allarddehaas.

j3k0 commented 5 years ago

@allarddehaas PR #331 fixed the issue for me, worth giving a try.

leiamac commented 5 years ago

I installed and tested that PR but the bug persists. The property correctOrientation does nothing either. Until this is fixed, is there some kind of workaround I can use to fix the images? I searched this issue and the suggestions I encountered didn't work (like using JPG as the encodingType or setting allowEdit to true)

leiamac commented 5 years ago

I'm still trying to find a fix for this. @mgvy91107 Could you resolve it? Or anyone else?

stephaneHillerCGI commented 5 years ago

Hi, I'm still experiencing this issue, is there any news about it ? Any workaround ?

leiamac commented 5 years ago

This isn't fixed. We had to release the app with this bug still occurring.

stephaneHillerCGI commented 5 years ago

@leiamac Sad, but thx for the information.

pengkobe commented 5 years ago

I encounter the problem too and i have to fix it by setting the allowEdit option to true which is not such a good solution though. Anyone got any idea to resolve this?

jonathan-chin commented 5 years ago

I'm experiencing the same issue. I didn't try the PR but enabled the allowEdit option as @pengkobe suggested.

This solves it for me. I was going to allow them to edit the photo anyway, so it turned out well for my use case.

SongThnappa commented 5 years ago

Does anyone plan on fixing this or is this a feature not a bug? This was working for me then "broke" out of the blue. WHO EVER IS RESPONSIBLE GET OFF YOUR ASS!!!!!!!!!

SongThnappa commented 5 years ago

This has been an issue going back to 2016/2017 WHO IS IN CHARGE OF FIXING THIS!!!

REPTILEHAUS commented 5 years ago

Yep also hitting this.

alexander-soare commented 4 years ago

Lol also. Actually I'm having the same issue with MediaCapture as I'm using that to capture video.

Thul999 commented 4 years ago

Any news on this issue? I would use allowEdit: true but the plugin documentation disencourages it because it's unpredictable.

MukeshKushwahAlphawizz commented 4 years ago

use this property from CameraOptions :

correctOrientation: true

Hope it solves

mrbdrm commented 3 years ago

Same issue here on Samsung fold was ok on android 7 but after updating to 9 the issue appear. i already set the correctOrientation: true

lenanex commented 3 years ago

This issue is still on and nobody seems to care. Feels like the number of app using this plugin on Samsung phone is ridiculously low...

pablo-the-dev commented 2 years ago

I am also hitting this issue. Interestingly, I only see this issue when .heic images are chosen, and on android.

yhsang2 commented 1 year ago

Nice to meet you. I solved this problem. Please refer to the information below and modify the source code.

  1. Use JPEG in the setOptions. function setOptions(srcType) { var options = { quality: 100, ... encodingType: Camera.EncodingType.JPEG, ... }

  2. A simple modification of the source code is required. CameraLauncher.java 698

    if (exifData != null && this.encodingType == JPEG) {
        try {
            //if (this.correctOrientation && this.orientationCorrected) {    <---- BEFORE!!!
            if (this.correctOrientation) { // <----- AFTER!!!
                exifData.resetOrientation();
            }
            exifData.createOutFile(modifiedPath);
            exifData.writeExifData();
            exifData = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

My app was criticized for this problem o(TヘTo) URL : https://play.google.com/store/apps/details?id=io.cordova.seoulfilter