Hi,
I see this question asked a number of times but no one seems to have an answer that works. All the questions are many months old so I thought I would ask again.
This is a question about Android not iPhone. Everything works perfectly in iPhone.
When calling Ti.Media.openPhotoGallery / Ti.Media.showCamera the blob that is returned "event.media" never has event.media.width or event.media.height set. It does in iPhone. How can I get the width and the height of the image that gets returned in Android?
Ti.Media.openPhotoGallery({ mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ], allowEditing: false, saveToPhotoGallery: true, success: function(event) { alert(event.media.width); <------ Always zero in Android, returns the correct width in iPhone } });Thanks in advance for any help.
1 Answer
Hi Spicer,
Try this code....
Ti.Media.openPhotoGallery({ mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], allowEditing : false, saveToPhotoGallery : true, success : function(event) { var imgPhoto = Ti.UI.createImageView({ height : 'auto', width : 'auto', zIndex : -2345, image : event.media }); win.add(imgPhoto); var i = imgPhoto.toImage(); alert("Height:" + i.height + " width:" + i.width); } });
Your Answer
Think you can help? Login to answer this question!