This PR addresses an issue with the getOrientationMatrix method in the ImageResizer class, which did not handle file paths and URIs correctly for both internal app storage and external storage across different Android versions, especially after the introduction of Scoped Storage changes in Android 10 (API level 29).
The existing implementation had the following limitations:
It did not handle internal app storage file paths correctly.
It did not use the MediaStore API to retrieve content URIs for external storage file paths/URIs on Android 10 and above, as required by the Scoped Storage changes.
This PR updates the getOrientationMatrix method to handle the following scenarios:
For internal app storage file paths (starting with /data/), it directly creates a File object from the file path and uses it to create the ExifInterface instance.
For external storage file paths/URIs:
On Android 10 (API level 29) and above, it uses the MediaStore API to retrieve the content URI for the file path/URI and creates the ExifInterface instance from the content URI, adhering to the Scoped Storage changes.
On Android versions below 10, it uses the provided file path/URI directly to create a File object and then creates the ExifInterface instance from the file path.
The changes ensure that the getOrientationMatrix method works correctly for various file path/URI scenarios, taking into account the Scoped Storage changes introduced in Android 10.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This PR addresses an issue with the
getOrientationMatrix
method in theImageResizer
class, which did not handle file paths and URIs correctly for both internal app storage and external storage across different Android versions, especially after the introduction of Scoped Storage changes in Android 10 (API level 29).The existing implementation had the following limitations:
MediaStore
API to retrieve content URIs for external storage file paths/URIs on Android 10 and above, as required by the Scoped Storage changes.This PR updates the
getOrientationMatrix
method to handle the following scenarios:For internal app storage file paths (starting with
/data/
), it directly creates aFile
object from the file path and uses it to create theExifInterface
instance.For external storage file paths/URIs:
MediaStore
API to retrieve the content URI for the file path/URI and creates theExifInterface
instance from the content URI, adhering to the Scoped Storage changes.File
object and then creates theExifInterface
instance from the file path.The changes ensure that the
getOrientationMatrix
method works correctly for various file path/URI scenarios, taking into account the Scoped Storage changes introduced in Android 10.