Skip to content
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

Handle file paths and URIs for internal and external storage across Android versions #404

Closed
wants to merge 2 commits into from

Conversation

ThienMD
Copy link

@ThienMD ThienMD commented Jun 18, 2024

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:

  1. It did not handle internal app storage file paths correctly.
  2. 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.

Fix some issues on android:
- Android SDK > 29
- Handle Uri from internal
Copy link

stale bot commented Aug 17, 2024

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.

@stale stale bot added the wontfix label Aug 17, 2024
Copy link

stale bot commented Aug 24, 2024

This pull request has been automatically closed. Thank you for your contributions.

@stale stale bot closed this Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant