-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(file-picker): pass mime types to pickImages(...)
#106
Comments
I think we could implement this for Android but I'm not sure if it's possible on iOS. Just out of interest: Why don't you use the |
pickImages(...)
@robingenz on iOS is only PHPickerFilter available. Apples says:
However, maybe we could integrate a filter function like and in Swift screenshots, and gifs can be excluded:
but it means, on iOS its possible to filter for gif:
And the filter function can filter screenshots, videos etc - maybe its time for an large iOS filter function ;) ? |
@stephan-fischer Thanks for sharing! I definitely plan to support the filter on iOS. But I don't like options like |
@robingenz I'm looking forward to it! Do you think there is a generic solution to create such complex filtering? Right now I actually need a filter for my app that allows real photos only, and not screenshots, no GIFs - its also good for photographer upload tools etc. |
Perhaps we could map each PHPickerFilter to a mime type. For example, if |
Should the user add multiple image types, like png and gif -> .screenshot + .animated? |
Yes, this would be great, just like the "types" option in pickFiles. PRs are welcome. |
OK, great! I thought about it a little more. Means .pickImage({
types: ['image/png'], // android only
filter: ['images', 'not:screenshot', 'not:animated'] // ios only - short alternative to have include, exlcude array
}); to have the maximum flexibility? filter: [FilePickerFilter.Images, FilePickerFilter.NoScreenshot, FilePickerFilter.NoAnimation] This filter works also on pickMedia and pickVideo. static let bursts: PHPickerFilter If separate options are better, than we need another issue only for ios and filter 😊 |
Interesting idea. In principle, I would have no problem with it. What I don't like is that every enum would have to exist twice, i.e. I would prefer the following: /**
* The list of filters to apply to the picker.
*
* Only available on iOS (14+).
*
* @since 5.4.0
* @see https://developer.apple.com/documentation/photokit/phpickerfilter/3952798-all
*/
includeFilters?: Filter[];
/**
* The list of filters to exclude from the picker.
*
* Only available on iOS (14+).
*
* @since 5.4.0
* @see https://developer.apple.com/documentation/photokit/phpickerfilter/3952802-not
*/
excludeFilters?: Filter[]; |
Wait, shouldn't it only be necessary to define excluded types? The included types are already defined by the plugin methods, for example:
The following should therefore be enough: /**
* The list of filters to exclude from the picker.
*
* Only available on iOS (14+).
*
* @since 5.4.0
* @see https://developer.apple.com/documentation/photokit/phpickerfilter/3952802-not
*/
excludeFilters?: Filter[]; |
Yes you are right, but pickMedia can have the includeFilters function, and configuration.filter = .playbackStyle(.imageAnimated) Or this option has only pickMedia? |
You are right. But we should only add the |
Sounds like a plan 😉 means, we can rewrite PickMediaOptions but we have to add specific definitions for
|
I just created a new branch
No, this issue is fine. |
Thank you! And on Android we can provide as pull request the mime type param. |
Yes, but for Android I would like to have a separate PR as soon as #121 is merged. |
Plugin(s)
Current problem
As a user I can select a .webp and .gif image using the .pickImage method
Preferred solution
put a type parameter in .pickImage
to filter out only JPG images
Alternative options
No response
Additional context
No response
Before submitting
The text was updated successfully, but these errors were encountered: