Created
May 17, 2016 10:17
-
-
Save rakhimoni/7d11a178dcef9e4e51e60560d28cbb9c to your computer and use it in GitHub Desktop.
Working with openPhotoGallery and get image vales
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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