Skip to content

Instantly share code, notes, and snippets.

@rakhimoni
Created May 17, 2016 10:17
Show Gist options
  • Select an option

  • Save rakhimoni/7d11a178dcef9e4e51e60560d28cbb9c to your computer and use it in GitHub Desktop.

Select an option

Save rakhimoni/7d11a178dcef9e4e51e60560d28cbb9c to your computer and use it in GitHub Desktop.
Working with openPhotoGallery and get image vales
var win = Ti.UI.createWindow({
backgroundColor:'#336699',
});
var view = Titanium.UI.createView({
borderRadius:10,
backgroundColor:'red',
width:500,
height:500
});
view.addEventListener('click',function(e){
//obtain an image from the gallery
Titanium.Media.openPhotoGallery({
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO],
success:function(event)
{
var image = event.media;
Ti.API.info('Our type was: '+JSON.stringify(image));
Ti.API.info('image native path: ' + image.nativePath);
Ti.API.info('image name: ' + image.file.name);
},
cancel:function()
{
//user cancelled the action from within
//the photo gallery
}
});
});
win.add(view);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment