BigImageViewer icon indicating copy to clipboard operation
BigImageViewer copied to clipboard

Choose MIME type for saving image?

Open DaveMurchison83 opened this issue 3 years ago • 5 comments

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.

DaveMurchison83 avatar Dec 09 '21 16:12 DaveMurchison83

PR is welcome!

Piasy avatar Dec 11 '21 09:12 Piasy

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, 还是我使用错误?

stephenchowxingxing avatar Dec 03 '22 08:12 stephenchowxingxing

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

Piasy avatar Dec 03 '22 09:12 Piasy

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

targetSdkVersion 29 没问题, targetSdk 32 报错。

stephenchowxingxing avatar Dec 03 '22 11:12 stephenchowxingxing

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

Piasy avatar Dec 12 '22 00:12 Piasy