I am working on a React Native project where I am using the CameraRoll library to access photos from the device's gallery. My requirement is to determine whether each photo was originally taken in landscape or portrait mode.
I have successfully fetched the photos using CameraRoll.getPhotos(), but the returned object does not seem to provide explicit information about the original orientation (landscape or portrait) of the photos. Here is an example of the data I am getting:
{
"extension": "jpg",
"fileSize": 1057317,
"filename": "example.jpg",
"height": null,
"orientation": 0,
"playableDuration": null,
"uri": "file:///example-path",
"width": null
}
As you can see, the width and height are returning null, and I am not sure how to use the orientation field to determine the original mode of the photo.
Is there a way to accurately determine if each photo was taken in landscape or portrait mode using CameraRoll? I am open to using additional libraries if necessary.
Thank you for your assistance.
I'm not familiar with
CameraRollbut if you want to, you can take an advantage ofImage.getSizeorImage.resolveAssetSourcemethodhere's a
Hookexample to useImage.getSizemethod [untested]and later you can use it like this