This is how i am creating an xtype. But this does not work at all, the getImageData is not being invoked at all. Can somebody shed some light on this?
items: [
{
xtype: 'image',
flex: 9,
height: '100px',
itemId: 'imageFieldData',
width: '100px',
src:'resources/images/icon_camera.png',
getImageData : function()
{
if(Ext.browser.is.PhoneGap)
{
navigator.camera.getPicture(this.setImageData, function(message){console.log(message);}, { quality: 50 });
}
},
setImageData : function(imageData){
console.log("data:image/jpeg;base64," + imageData);
console.log(t);
console.log(this);
this.setSrc(imageData);
},
listeners:[
{
element: 'element',
event: 'tap',
fn: function(e,t) {
this.getImageData();
}
}
]
}
]
I have modified the code a little bit to add more functionlity with buttons to take picture from the camera and also choose from the gallery. Here is the code and it works.