mirror of
https://github.com/status-im/react-native-camera-roll.git
synced 2026-08-28 11:51:07 +00:00
fix(android): Handle Null case when reading orientation (#456)
commit e4e239c374e6ac74f095f060ae3e0e4fcb925ee7 Author: Mats01 <“matej.butkovic@gmail.com”> Date: Wed Jan 18 21:00:40 2023 +0100 add isnull orientation check commit ed312f6d53e109691d586bd00c21597426b2a7ae Author: Mats01 <“matej.butkovic@gmail.com”> Date: Wed Jan 18 17:16:17 2023 +0100 add check if rotation was read commit 6a156435ba31bcdd3bd3f4aa846f0d9bb2f11fbe Author: Mats01 <“matej.butkovic@gmail.com”> Date: Fri Jan 13 14:29:09 2023 +0100 return whitespace to original state commit 87f268c957e0348893ef1b576f1de10a006e3a68 Author: Mats01 <“matej.butkovic@gmail.com”> Date: Fri Jan 13 14:03:05 2023 +0100 update readme commit ff328f581ce4720541741f18ebf0e43d0698ba6e Author: Mats01 <“matej.butkovic@gmail.com”> Date: Fri Jan 13 14:00:42 2023 +0100 reverse witdh-height on andorid if orientation indicates rotation commit 89dd22831dd1d8f8fc7d362f2511cf8dd55ffa15 Author: Mats01 <matej.butkovic@fer.hr> Date: Thu Jan 12 18:54:10 2023 +0100 add orientation to data return about image Co-authored-by: Mats01-fer <“matej.butkovic@gmail.com”>
This commit is contained in:
@@ -675,7 +675,11 @@ public class CameraRollModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
if (includeOrientation) {
|
||||
image.putInt("orientation", media.getInt(orientationIndex));
|
||||
if(media.isNull(orientationIndex)) {
|
||||
image.putInt("orientation", media.getInt(orientationIndex));
|
||||
} else {
|
||||
image.putInt("orientation", 0);
|
||||
}
|
||||
} else {
|
||||
image.putNull("orientation");
|
||||
}
|
||||
@@ -827,11 +831,13 @@ public class CameraRollModule extends ReactContextBaseJavaModule {
|
||||
|
||||
}
|
||||
|
||||
int orientation = media.getInt(orientationIndex);
|
||||
if (orientation % 180 != 0) {
|
||||
int temp = width;
|
||||
width = height;
|
||||
height = temp;
|
||||
if(!media.isNull(orientationIndex)) {
|
||||
int orientation = media.getInt(orientationIndex);
|
||||
if (orientation >= 0 && orientation % 180 != 0) {
|
||||
int temp = width;
|
||||
width = height;
|
||||
height = temp;
|
||||
}
|
||||
}
|
||||
|
||||
image.putInt("width", width);
|
||||
|
||||
Reference in New Issue
Block a user