Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2574] iOS7: openPhotoGallery returns empty media on success event

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2014-04-23T05:02:11.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsmedia
ReporterMarc Andrew Landles
AssigneeRitu Agrawal
Created2014-02-18T18:54:52.000+0000
Updated2016-03-08T07:41:38.000+0000

Description

Testing code:
 
Ti.Media.onpenPhotoGallery({
    success: function(event) {
         Ti.API.debug(JSON.stringify(event));
    }
}); 
Result JSON: bq. {"code":0,"type":"success","source":{},"mediaType":"public.image","success":true,"media":{}} Works well on Android 4.4

Comments

  1. Marc Andrew Landles 2014-02-19

    The event.media seems empty on a JSON.stringify(event.media). I found that iOS needs to write the BLOB object to a file before and after you can handle it like a file object. Working code:
     
       Ti.Media.onpenPhotoGallery({
           success: function(event) {
                var tempFile = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'picture.jpg');
                tempFile.write(event.media);
       
                // Add the use of the image file
           }
       }); 
       
    JSON.stringify() still shows the file has empty though ...
  2. Ritu Agrawal 2014-03-17

    I am having problem running this code on both iOS and Android platforms. I will try on another device now.
  3. Vishal Duggal 2014-03-18

    The Blob is being created with actual image Data. iOS does not send out any media url info. Hence blob has no properties.

JSON Source