This is a migrated thread and some comments may be shown as answers.

Icenium sample camera example... to save image as data type image

1 Answer 42 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Arun
Top achievements
Rank 1
Arun asked on 10 Jun 2013, 05:23 AM
In Icenium sample camera example how to save image as data type "image".How to encode the "imagedata" argument from _onPhotoDataSuccess function to image type..Please help..right now the value i am getting in "imagedata" is the path..

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 12 Jun 2013, 01:04 PM
Hi Arun,

The imageData parameter of onSuccess callback function contains the Base64 encoding of the image data, OR the image file URI, depending on cameraOptions used. If destinationType camera option is DATA_URL, then consider the following example:

navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
    destinationType: Camera.DestinationType.DATA_URL
 });
 
function onSuccess(imageData) {
    var image = document.getElementById('myImage');
    image.src = "data:image/jpeg;base64," + imageData;
}
 
function onFail(message) {
    alert('Failed because: ' + message);
}

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Arun
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or