If I pass { 'destinationType': navigator.camera.DestinationType.DATA_URL} to the camera.getPicture method, it works file, but the image data size is huge.
I don't need high resolution and I decided to provide targetWidth and targetHeight options to get smaller photos.
But once I add these options like this: { 'destinationType': navigator.camera.DestinationType.DATA_URL, 'targetWidth': 480, 'targetHeight': 640} the camera.getPicture method returns nothing. No code in success or error callbacks is executed. Just nothing happens.
What might be wrong?
8 Answers, 1 is accepted
This is a known issue within the companion app which comes from the specifics of the Camera plugin and the location services on iOS8 devices.
We plan to push a fix to the companion app that works around this behavior. In the meantime, there is a simple fix you can apply in your application. You can add another CameraOptions property next to the one for targetWidth and targetHeight : encodingType: Camera.EncodingType.PNG:
var
config = {
destinationType: Camera.DestinationType.DATA_URL,
targetHeight: 400,
targetWidth: 400,
encodingType: Camera.EncodingType.PNG
};
Give this a try and let me know if it helps.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.
I am glad it helps, but keep in mind that changing the encoding type to PNG will make your camera take pictures with no EXIF information (such as where the picture was taken). This is exactly the reason why this line helps overcome the issue until we address it.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.
The issue discussed in this thread was resolved a while ago. Can you please submit a support ticket and attach your project there so we can investigate the issues you are having. We would also need to know the steps we can follow to reproduce the behavior you described.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.
Thanks, Tina.. I have resolved the issue by giving the targetheight.
Here is my working code
navigator.camera.getPicture(onSuccess, onFail, {
quality: 50,
targetWidth: 600,
targetHeight: 600,
encodingType: Camera.EncodingType.PNG,
correctOrientation: true,
destinationType: destinationType.DATA_URL
});
Hi,
i am facing same issue .photo is not displaying after click on use photo option complete blank page appears.
here is my code .its hybrid application its working on android device fine problem with ios device only.
var config = {
destinationType: Camera.DestinationType.FILE_URI,
targetHeight: 400,
targetWidth: 400,
encodingType: Camera.EncodingType.PNG
};
Can you replicate the issue in the Camera sample app. I've tried on my side but capturing photos seem to work as expected even with the configuration you specified. The photo is captured and then displayed in the app.
If you can replicate the problem, please submit a support ticket and provide us with a small sample where we can see the issue or with the list of steps we can follow to replicate it in the sample Camera app.
Regards,
Tina Stancheva
Telerik
Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.