PDA

View Full Version : Ext.device.Camera.capture returns default image



sindoki
23 Aug 2012, 1:24 PM
Hello, everyone.
The question is following...
I want to pick a picture from a device memory or from camera. I use this code:

Ext.device.Camera.capture({
success: function (image) {
var imageView = Ext.getCmp('imageEditField');
imageView.setSrc(image);
},
quality: 75,
width: 64,
height: 64,
destination: 'file',
options: {
source: 'album'
}
});

But this code only places the default sencha image (the tea leaf) in the image field and doesn't prompt to pick or shot a picture. I tried many variants of Source and Destination parameters but result remains the same.
What should I do?

mitchellsimoens
26 Aug 2012, 5:53 AM
Is this on actual device?

sindoki
26 Aug 2012, 12:06 PM
Yes, it is.
Actually, I've worked it out. For some reason, Ext.browser.is.WebView returned FALSE on my Android device and everything was done on simulator. So I edited Camera.js a bit and everything worked fine, I got a picture.
But after that I edited my image capture code and got another problem: when I pick a picture or make a photo it isn't set into my image bar. As the image uri I get "User has canceled operation". Why does it happen? A don't know, which modification led to this mistake, I edit my code back and still have this message.
Here it is:

{
xtype: 'button',
margin: 5,
text: 'Make a picture',
handler: function (btn, evt) {
Ext.device.Camera.capture({
source: 'camera',
success: function (uri) {
var imageView = Ext.getCmp('imageEditField');
imageView.setSrc(uri);
},
failure: function(){
console.log('failure', arguments);
},
quality: 75,
destination: 'file'
},
this,//scope
'file',//destination
'jpg',//encoding:
80,//width
80 //height
);
}
}

caseyd
29 Nov 2012, 7:42 AM
I am having this issue too - I am using a device - via browser - is this correct, or do I have to deploy as app to see actual operation?