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

image_picker add picture limit to getMultiImage #85772

Closed
vytautas-pranskunas- opened this issue Jul 2, 2021 · 24 comments · Fixed by flutter/packages#6201 or flutter/packages#6434
Closed
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: image_picker The Image Picker plugin. P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@vytautas-pranskunas-
Copy link

Hi,

It would be great to have ability to set limit on amount of pictures that can be selected. e.g. maxPictures: 3

@MFrankestien
Copy link

Can you give more explanation?
Do you want to limit the number of photos at one time, or limit the number of photos that he can choose in the long run?

@vytautas-pranskunas-
Copy link
Author

At one time. When I open image picker it would be good to allow user select max upto N photos.

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Jul 5, 2021
@darshankawar
Copy link
Member

plugin version https://pub.dev/packages/image_picker/changelog#0812 added multi-image selection feature.

Screenshot 2021-07-05 at 1 26 29 PM

@darshankawar darshankawar added p: first party p: image_picker The Image Picker plugin. c: proposal A detailed proposal for a change to Flutter c: new feature Nothing broken; request for a new capability and removed in triage Presently being triaged by the triage team labels Jul 5, 2021
@vytautas-pranskunas-
Copy link
Author

vytautas-pranskunas- commented Jul 5, 2021

@darshankawar this proposal is about limit of multi-image selection. Or you just dropped comments for others? :)

@stuartmorgan stuartmorgan added the P3 Issues that are less important to the Flutter project label Jul 8, 2021
@ydag
Copy link

ydag commented Jul 21, 2021

Hi @vytautas-pranskunas-,

We can have this feature for iOS but it seems there is no way to do it for Android. We are using EXTRA_ALLOW_MULTIPLE to fetch multiple images on Android and as it is stated in here it is not possible with the current implementation. If someone knows another way to handle please let us know. We would be happy to work on this.

But for the moment, since the support is only limited to iOS I will discuss within the team if we want to implement it for iOS only.

@mvanbeusekom
Copy link

As mentioned by @ydag, this functionality is only supported on iOS and won't work on other platforms (Android and Web). So we are wondering if this will still add value if it is only supported on iOS.

We can imagine that it will give a bit better user experience on iOS were users are simply not able to select more than the maximum amount of images. But this means developers should still handle the other platforms in their own logic (e.g. show the user a warning when more than the maximum amount of images are selected).

If you would like this feature to be implemented with support for iOS only please leave a 👍 on this comment. When we generate enough feedback we will provide the necessary implementation.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@stuartmorgan
Copy link
Contributor

Re-opening based on the use case described in #116588 (comment); having a best-effort plugin cutoff even on unsupported platform would allow us to bypass steps like resampling images for those past the cutoff. We would just need to be very clear in the API docs that on some platforms the UX of this won't actually prevent users from thinking they are picking more images.

@hectorAguero
Copy link

hectorAguero commented Jun 12, 2023

Now also android has native support for this feature, and image_picker package already can use the Android PhotoPicker.

One of the issues would be the API compatibility, officially Android 11 (API level 30) or higher, but with an entry in the manifest the API can force the installation of the photopicker by google play services.

I think Image_picker should return and error if the platform or device doesn't have support for the feature, so developers can rely in call getImage multiples times, or use a custom image picker, like other flutter packages implementations.

@SreehariRajeevFSS

This comment was marked as off-topic.

@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
@Hixie Hixie removed the plugin label Jul 6, 2023
@flutter-triage-bot flutter-triage-bot bot added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 8, 2023
@EgorK0rshun
Copy link

EgorK0rshun commented Aug 30, 2023

is it possible to make a callback directly, the PickMultiVisualMedia(maxImage) method from native android

open class PickMultipleVisualMedia(
    private val maxItems: Int = getMaxItems()
)

@stuartmorgan

This comment was marked as off-topic.

@superwebarmy

This comment was marked as off-topic.

@BunnyBuddy
Copy link

is it possible to make a callback directly, the PickMultiVisualMedia(maxImage) method from native android

open class PickMultipleVisualMedia(
    private val maxItems: Int = getMaxItems()
)

Has anybody implemented this in Flutter?

@stuartmorgan
Copy link
Contributor

I think Image_picker should return and error if the platform or device don't have support for the feature

The pattern we use for things like this is generally https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#api-support-queries, not erroring out.

@lesliearkorful
Copy link

lesliearkorful commented Jan 15, 2024

I get that an old Android limitation was stalling this PR.
But there's a solution now in the Android docs. Is it not enough?
https://developer.android.com/training/data-storage/shared/photopicker#select-multiple-items

They also provided solution for backward compatibility
https://developer.android.com/training/data-storage/shared/photopicker#device-availability

@stuartmorgan
Copy link
Contributor

I get that an old Android limitation was stalling this PR.

There's no PR here, only a feature request. Anyone interested in implementing this is welcome to submit a PR (which has been the case since this comment).

@ihijazi

This comment was marked as off-topic.

@Sun3

This comment was marked as off-topic.

@ihijazi

This comment was marked as off-topic.

@stuartmorgan

This comment was marked as off-topic.

auto-submit bot pushed a commit to flutter/packages that referenced this issue Apr 7, 2024
Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions`. The `limit` argument defines how many images or media files can be select.

Only platform interface package changes taken from: #6201

Fixes: [flutter/flutter#85772](flutter/flutter#85772)
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Apr 8, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this issue Apr 16, 2024
…Media to ios and Android (#6201)

Adds limit parameter to `MediaOptions` and `MultiImagePickerOptions` and supports its use on iOS and Android. The `limit` argument defines how many images or media files can be select.

Fixes: [flutter/flutter#85772](flutter/flutter#85772)
@wuweijian1997
Copy link

@darshankawar pickMultiImage not work in android

@darshankawar
Copy link
Member

@wuweijian1997 Please file a new issue using issue template and provide relevant details so that we can address it properly.

Copy link

github-actions bot commented May 3, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: image_picker The Image Picker plugin. P3 Issues that are less important to the Flutter project package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
17 participants