Created
June 3, 2019 20:01
-
-
Save exclusiveTanim/66f0198080f96b51fcfc356e416f6941 to your computer and use it in GitHub Desktop.
base64encode image
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(); | |
| win.open(); | |
| function takePhoto() { | |
| Ti.Media.showCamera({ | |
| mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO], | |
| success: function(event) { | |
| console.log(event); | |
| if(event.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) { | |
| var image = event.media; | |
| Ti.API.info(Ti.Utils.base64encode(image)); | |
| Ti.API.info(Ti.Utils.base64encode(image).text); | |
| } | |
| }, | |
| error: function(e) { | |
| }, | |
| cancel: function(e) { | |
| } | |
| }); | |
| } | |
| win.addEventListener('click', function(e) { | |
| var hasCameraPermissions = Ti.Media.hasCameraPermissions(); | |
| if (hasCameraPermissions) { | |
| takePhoto(); | |
| } | |
| Ti.Media.requestCameraPermissions(function(e) { | |
| takePhoto(); | |
| }); | |
| }); |
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
| <ios> | |
| <plist> | |
| <dict> | |
| <key>NSCameraUsageDescription</key> | |
| <string>ADD_YOUR_PERMISSION_TEXT_HERE</string> | |
| </dict> | |
| </plist> | |
| </ios> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment