flutter icon indicating copy to clipboard operation
flutter copied to clipboard

image_picker add picture limit to getMultiImage

Open vytautas-pranskunas- opened this issue 3 years ago • 21 comments

Hi,

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

vytautas-pranskunas- avatar Jul 02 '21 11:07 vytautas-pranskunas-

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?

MFrankestien avatar Jul 03 '21 02:07 MFrankestien

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

vytautas-pranskunas- avatar Jul 03 '21 06:07 vytautas-pranskunas-

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 avatar Jul 05 '21 07:07 darshankawar

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

vytautas-pranskunas- avatar Jul 05 '21 08:07 vytautas-pranskunas-

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.

ydag avatar Jul 21 '21 12:07 ydag

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.

mvanbeusekom avatar Jul 27 '21 15:07 mvanbeusekom

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[bot] avatar Aug 10 '21 17:08 github-actions[bot]

Re-opening based on the use case described in https://github.com/flutter/flutter/issues/116588#issuecomment-1339681035; 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.

stuartmorgan avatar Dec 06 '22 17:12 stuartmorgan

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.

hectorAguero avatar Jun 12 '23 03:06 hectorAguero

any updates on adding the limit for pickMultiImage()?

SreehariRajeevFSS avatar Jun 14 '23 13:06 SreehariRajeevFSS

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

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

EgorK0rshun avatar Aug 30 '23 10:08 EgorK0rshun

Please see https://github.com/flutter/flutter/wiki/Issue-hygiene#when-will-my-bug-be-fixed and https://github.com/flutter/flutter/wiki/Issue-hygiene#escalating-an-issue-that-has-the-wrong-priority

Pinging everyone who has touched a bug is not a valid escalation path. Please don't do that.

stuartmorgan avatar Sep 12 '23 20:09 stuartmorgan

any update on this feature? are you guys planning to integrate this feature in package?

superwebarmy avatar Sep 17 '23 16:09 superwebarmy

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?

BunnyBuddy avatar Dec 21 '23 05:12 BunnyBuddy

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.

stuartmorgan avatar Jan 02 '24 14:01 stuartmorgan

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

lesliearkorful avatar Jan 15 '24 15:01 lesliearkorful

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).

stuartmorgan avatar Jan 16 '24 17:01 stuartmorgan

Any updates on the limit option? Has it been added?

ihijazi avatar Mar 20 '24 12:03 ihijazi

Any updates on this feature? It's really important for apps that restrict the number of images to be picked. You do not want the user to pick 10 images then say, you can only save 4 of them...

Thanks...

Sun3 avatar Mar 22 '24 20:03 Sun3

Any updates on the limit option? Has it been added?

Why it has been marked as off-topic?

ihijazi avatar Mar 23 '24 05:03 ihijazi

Why it has been marked as off-topic?

See https://github.com/flutter/flutter/wiki/Issue-hygiene#do-not-add-me-too-or-same-or-is-there-an-update-comments-to-bugs

stuartmorgan avatar Mar 23 '24 12:03 stuartmorgan

@darshankawar pickMultiImage not work in android

wuweijian1997 avatar Apr 19 '24 03:04 wuweijian1997

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

darshankawar avatar Apr 19 '24 05:04 darshankawar

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[bot] avatar May 03 '24 06:05 github-actions[bot]