1. #1
    Sencha User
    Join Date
    Sep 2012
    Location
    India
    Posts
    16
    Vote Rating
    0
    Vishwastalule is on a distinguished road

      0  

    Default 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
                        });
                    }
                }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    67
    Vote Rating
    3
    Answers
    1
    PhilMerrell is on a distinguished road

      0  

    Default


    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%" />');
        }
    });