-
7 Jan 2013 7:07 AM #1
Unanswered: how to set image captured by camera using setHTML mehtod in ST 2.1?
Unanswered: how to set image captured by camera using setHTML mehtod in ST 2.1?
I want to set image captured by camera using
Code:'button[action=Start_Cam]':{ tap:function(){ Ext.device.Camera.capture({ source: 'camera', destination: 'data', success: function(image) { var imageView=Ext.getCmp('capturedImage'); imageView.setHtml('<img id="get_captured_image" src='+image+' height=auto; width=auto;>'+'</img>' ); Ext.getCmp('start_button').setHidden(true) ; Ext.getCmp('detect_face').setHidden(false); }, failure: function() { Ext.Msg.alert('Error', 'There was an error when acquiring the picture.'); }, scope: this }); } }
-
9 Jan 2013 7:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
Haven't used the camera in a long time, does the string data have 'data:image/png;base64,' at the start?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
9 Jan 2013 12:58 PM #3
I assume you are somehow deploying this to a native app via phonegap or native packager. If so this works for me (just tested):
Code:Ext.device.Camera.capture({ source: 'camera', destination: 'file', success: function(url) { var userImageContainer = Ext.ComponentQuery.query('#userImageContainer')[0]; userImageContainer.setHtml('<img src="'+url+'" width="100%" />'); } });


Reply With Quote