[How to use] how to correctly set "image size constraint" in filter option
Platforms
dart, Android
Description
I am on version 2.7.2, and now deal with some pictures with 0 width * 0 height. (I don't know why it is recognized as 0w*0h, but It is a picture, which shows in my phone's native gallery app)
I have noticed there is a filterOption param in method getAssetPathList and there is SizeConstraint in imageOption, of which the default value is:
const SizeConstraint({
this.minWidth = 0,
this.maxWidth = 100000,
this.minHeight = 0,
this.maxHeight = 100000,
this.ignoreSize = false,
});
On my android phone(android 10, EMUI 11.0.0), even the minWidth and minHeight set to 0, those 0 width and 0 height pictures still get filtered. Only when I set ignoreSize to true will they appear. But on an android 10 emulater, with the default filter option, those pictures will show up correctly.
This is weird why the behavior is different. Which doesn't make sense but it is the case. Maybe just an unexpected behavior of this particular android version of my phone and sadly I cannot even reproduce it on emulator.
So, to make things works, setting ignoreSize might be the only workaround for me. The question is what actually does ignoreSize do? Is it just bypass size check? will it causes more trouble if I set it to true?
My code
just calling PhotoManager.getAssetPathList to get all image folders
Try do it
No response
Images with width and height 0 are not included.See https://github.com/fluttercandies/flutter_photo_manager/blob/3862ce87020041a64f96172ce835ed3ce66a7406/android/src/main/kotlin/com/fluttercandies/photo_manager/core/entity/filter/CommonFilterOption.kt#L54 I think sizeWhre is redundant, because the image size limit is filtered in getCondFromType.
I am on version 2.7.2, and now deal with some pictures with 0 width * 0 height. (I don't know why it is recognized as 0w*0h, but It is a picture, which shows in my phone's native gallery app)
On my android phone(android 10, EMUI 11.0.0), even the minWidth and minHeight set to 0, those 0 width and 0 height pictures still get filtered. Only when I set ignoreSize to true will they appear. But on an android 10 emulater, with the default filter option, those pictures will show up correctly.
Recently I came back to track down the problem. Actually, this problem is caused by abnormal values in MediaStore. There are pictures whose width and height properties are "null"(missing) in MediaStore database. Thus some apps report they are "0 in width, 0 in height".
(this screenshot comes from the app https://github.com/eurozulu/MediastoreView)
I do not know how these rows get stored like this. Those pictures themselves are intact, so when I copy them to an android emulator, all wired things are gone.