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

Choose MIME type for saving image? #234

Open
DaveMurchison83 opened this issue Dec 9, 2021 · 5 comments
Open

Choose MIME type for saving image? #234

DaveMurchison83 opened this issue Dec 9, 2021 · 5 comments

Comments

@DaveMurchison83
Copy link

I came on here as my app was crashing on Android 11 due to the jpg/jpeg issue, but am I right in saying that ALL images are saved as jpeg? My app serves up images as either webp or animated gif images so would be good if I was able to save in these formats, either by auto-checking the filename, or forcefully choosing the mime type in the code.

Possible?

Thanks.

@Piasy
Copy link
Owner

Piasy commented Dec 11, 2021

PR is welcome!

@stephenchowxingxing
Copy link

stephenchowxingxing commented Dec 3, 2022

Redmi K40S,Android 12, image 加载onSuccess后:/data/user/0/com.example.testapp/cache/1670055364173_1,
使用saveImageIntoGallery时, 报错:

java.lang.IllegalArgumentException: Unsupported MIME type image/jpg
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:557)
at android.content.ContentResolver.insert(ContentResolver.java:2193)
at android.content.ContentResolver.insert(ContentResolver.java:2155)
at com.github.piasy.biv.view.BigImageView.saveImageIntoGallery(BigImageView.java:335)

大佬,这是bug, 还是我使用错误?

@Piasy
Copy link
Owner

Piasy commented Dec 3, 2022

应该还是新的 Android 系统存储权限相关的兼容性问题,我抽空看看更新一下吧

@stephenchowxingxing
Copy link

stephenchowxingxing commented Dec 3, 2022

将mCurrentImageFile替换成外部私有目录下的图片(xxx.png),把saveImageIntoGallery中的方法拿出来使用并没有什么错误。但是在demo中直接使用saveImageIntoGallery方法就出错.

targetSdkVersion 29 没问题, targetSdk 32 报错。

@Piasy
Copy link
Owner

Piasy commented Dec 12, 2022

@WonderfulHotel 我在 API 32 的模拟器,以及 API 31 的小米真机上测试 demo 的 LongImageActivity 里的 saveImageIntoGallery,项目设置 target API 33,都没有问题。

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

3 participants