Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23168] Android: Allow selecting multiple photos with Ti.Media.openPhotoGallery

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2016-05-26T07:19:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsAndroid
Labelsandroid, openphotogallery
ReporterManuel Lehner
AssigneeAshraf Abu
Created2016-04-07T16:51:11.000+0000
Updated2016-06-23T07:03:27.000+0000

Description

It would be nice to have an option to allow the user selecting multiple photos out of his gallery with Ti.Media.openPhotoGallery. Ther should be an allowMultiple option in here: http://docs.appcelerator.com/platform/latest/#!/api/PhotoGalleryOptionsType The current behavior is the selection window closes as soon as the first photo was selected.

Comments

  1. Sharif AbuDarda 2016-04-07

    Thanks for the feature request. This is a valid new feature. But, this need to pass our selection committee when and whether this will be included in the platform. You need to understand that the process is time consuming and lot of variables in play. Besides, We have so many other requests in our pipeline. Regards Sharif.
  2. Manuel Lehner 2016-04-26

    PR: https://github.com/appcelerator/titanium_mobile/pull/7967 Test code:
       var win = Ti.UI.createWindow({
         backgroundColor: '#fff',
         layout: 'vertical'
       });
       
       var button = Ti.UI.createButton({
         title: 'open gallery'
       });
       
       button.addEventListener('click', function(){
         Ti.Media.openPhotoGallery({
           allowMultiple: true,
           success: function(e){
             e.images.forEach(function(image){
               var imageView = Ti.UI.createImageView({
                 height: 300,
                 image: image.media
               });
               win.add(imageView);
             });
           }
         });
       });
       
       win.add(button);
       
       win.open();
       
  3. Manuel Lehner 2016-04-26

    This works fine for me. But I'm not sure what you do think about this. There's two issues: 1. The success callback is originally intended to return one single image. The PR introduces an images property which is basically an Array of [CameraMediaItemType](http://docs.appcelerator.com/platform/latest/#!/api/CameraMediaItemType) 2. The result handler creates Blobs for each image which can lead into memory problems since this allocates a lot of memory instead of just returning the paths. That might require a complete different way of handling the result data. What's you general opinion on this?
  4. Hans Knöchel 2016-05-06

    [~manuellehner] 1: It's fine, because it's simply a different property that deserves to act independently 2: So you would suggest to return just a string path instead of a blob? It's critical for sending data, because it requires blobs. But I'm not sure whats the best approach from the android perspective here. [~msamah]?
  5. Hans Knöchel 2016-05-26

JSON Source