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

For some reason in some devices the image is being rotated when using the file picker #190

Open
AzureStar123 opened this issue Jan 22, 2025 · 3 comments

Comments

@AzureStar123
Copy link

No description provided.

@vinceglb
Copy link
Owner

Hi @AzureStar123! Thanks for creating this issue!

  • What version of FileKit are you using?
  • Can you tell me which device models are experiencing this behavior?

I have sometimes experienced this issue on Samsung models, but I thought I deployed a fix for it.

@AzureStar123
Copy link
Author

I am using FileKit version 0.8.8

The issues are on Samsung Galaxy models, the s22 and a12.

I used this code to fix it for now:

actual fun getImageOrientation(image: PlatformFile): Int {

    val exif = ExifInterface(MyApplication.getContext().contentResolver.openInputStream(image.uri) ?: return 0)
    val orientation = exif.getAttributeInt(
        ExifInterface.TAG_ORIENTATION,
        ExifInterface.ORIENTATION_NORMAL
    )
    return when (orientation) {
        ExifInterface.ORIENTATION_ROTATE_90 -> 90
        ExifInterface.ORIENTATION_ROTATE_180 -> 180
        ExifInterface.ORIENTATION_ROTATE_270 -> 270
        ExifInterface.ORIENTATION_NORMAL -> 0
        else -> 0
    }
}

I paired this with Modifier.rotate(), it would be great if this could be directly integrated into the library to handle the correct orientation.

@vinceglb
Copy link
Owner

Ok thanks for the info! I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants