-
-
Notifications
You must be signed in to change notification settings - Fork 46
Image Orientation Issue #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
These other issues are related: |
Hi @Daxito, Could you provide some more info about the device or simulator, which you are using for testing? In the meantime you could also verify, whether you will have the same behavior with this sample app. Regards, |
My device is a Samsung Galaxy S5, Android 6.0.1. |
I am going to check why my App is changing the orientation and not the sample App even when both apps are using the same version of the plugin 0.0.8 |
Hi @Daxito, Could you give us some code snippets or sample project, which could be debugged locally? |
Hey Guys, Some modifications starting from NS camera's SampleApp: Added ...
<activity
android:name="com.tns.NativeScriptActivity"
...
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/LaunchScreenTheme">
... main-page.xml <Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="onLoaded">
<GridLayout class="container" rows="auto,*,auto">
<Label row="0" text="Take a picture" class="title"/>
<Image row="1" id="myImage" src="res://logo" stretch="aspectFill" />
<Button row="2" text="Take" tap="onTap" />
</GridLayout>
</Page> main-page.ts import { EventData } from 'data/observable';
import { Page } from 'ui/page';
import { takePicture } from 'camera';
var myImage;
export function onLoaded(args: EventData) {
var page = <Page> args.object;
myImage = page.getViewById('myImage');
page.bindingContext = {};
}
export function onTap() {
console.log('onTap');
takePicture({width: 700, height: 700, keepAspectRatio: true})
.then(picture => myImage.imageSource = picture);
} app.css .title {
font-size: 30;
horizontal-align: center;
margin: 20;
}
button {
font-size: 42;
horizontal-align: center;
}
.container {
padding: 20;
background-repeat: no-repeat;
background-position: center top;
}
Image {
top: 0;
border-radius: 290;
height: 290;
width: 290;
border-width: 6;
border-color: #00e988;
} package.json {
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.poc",
"tns-android": {
"version": "2.4.1"
}
},
"dependencies": {
"tns-core-modules": "^2.4.4"
},
"devDependencies": {
"babel-traverse": "6.19.0",
"babel-types": "6.19.0",
"babylon": "6.14.0",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^2.1.1"
}
} |
Hi @zweimal I notice that you are using the old camera Module. With NativeScript 2.4 Regards, |
@tsonevn |
Attached is a sample app showing the issue. Also, after taking the picture, we send it over to our server using the nativescript-background-http and the file we received is also in the wrong orientation. |
I'm having the same exact issue with both Sony Xperia T3 (d5103) and in Samsung Galaxy S4 (GT-I9505). |
The same code works well on a Oneplus One using Android 6.0.1 |
Hi @Daxito, Thank you for the sample project. I was able to reproduce this behavior on my side, while using Samsung S4 device. For further info, you could keep track on this issue. In the meantime, you could verify, the screen orientation by using You could review the below given example, where has been shown the given workaround. main-page.xml
main-page.js
Hope this helps |
@tsonevn |
Hi guys, i'm using the plugin and i noticed this bug on my device, i came up with a solutions that works on my device but it slower a bit the process.
And then just before the line
I'm not very skilled on android, if someone can propose a better solution it may help a lot of people, thank you |
Also experiencing this rotation issue on a Sony Xperia Z3, LG G4 and LG Spirit. Using version 0.0.8 of the camera plugin. |
Hi @gregersen79 have you tried my solution? does it work on your devices? thank you |
Hi @mounirka yes I implemented your solution and it worked well, thank you! So until this issue gets resolved I'll go with this. |
Okay, so after a little research I found, that if I'm loading an imageSource from the returned imageAsset, the imageSource will have a correct rotationAngle. |
Could you try to upgrade to latest NativeScript 2.5 and to verify, whether you will have the same problem with image orientation while using default |
@tsonevn I have an upcoming release of our app with Nativescript 2.4, but I will upgrade as soon as I get a change, should be the start of next week. |
i have the same problem on samsung galaxy 4, and after 2.5 other plugin broke so i can't test the camera :/ |
ok i disabled the plugin and the pictures are still being rotated |
@tsonevn issue still present on {N} 2.5 |
After days of bad feelings I just tried @mounirka solution and it works. |
I just migrated my code to use this plugin instead of the "default" one and I noticed that if I take a picture in portrait orientation, then the resulting image is saved in landscape orientation, the image does not keep the portrait orientation and is is hard to look at the picture without rotating the phone, this issue is not present in the "default camera module".
if the image is taken in landscape then it keeps it that way, no issue.
Any ideas?
Thanks
The text was updated successfully, but these errors were encountered: