Question

I am working on sencha from last 20 days or so i have learnt a lot , I have got access to device camera and capturing photo using that camera but the problem is that i want to show that captured image in a Div in my page using a button .. Couldn;t got the solution Please help if anyone knows .. Take a look at this ..

                            {
                       xtype:'button',
                       text:'Tap',
                       docked:'top',
                       handler:function(){

                       navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
                                                   destinationType: Camera.DestinationType.FILE_URI });

                       function onSuccess(imageURI) {
                       var image = document.getElementById('myImage');
                       image.src = imageURI;
                       }

                       function onFail(message) {
                       Ext.Msg.alert('Failed because: ' + message);
                       }                           }
                       },
                       {
                       xtype:'container',
                       html:'<div style="border:solid;border-color:red">Hello</div>',
                       id:'picture',
                       },

                       {
                       xtype:'container',
                       html:'<div style="border:solid; border-color=green">Hellow</div>',
                       items:[
         {
               xtype:'button',
               text:'Get',
              }
           ]
             },

what i have to do now ??

Was it helpful?

Solution

You need to do something with the element that has ID 'myImages'. In the onSuccess function you are setting the src of that element accordingly, but where is the element actually used? You should add it to one of the containers, either in the initial definition or when onSuccess is called. If you want to wait until the button with text 'Get' is pressed then either have that button's handler append the myImages element, or hide/show it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top