43 lines
875 B
JavaScript
43 lines
875 B
JavaScript
function Customer(o){
|
|
|
|
var defaults = {
|
|
'image_data' : 'customerupdate-photo_data'
|
|
|
|
};
|
|
|
|
init();
|
|
|
|
function init(){
|
|
|
|
defaults = $.extend(defaults,o);
|
|
|
|
Webcam.set({
|
|
width: 160,
|
|
height: 120,
|
|
dest_width: 320,
|
|
dest_height: 240,
|
|
image_format: 'jpeg',
|
|
jpeg_quality: 90,
|
|
// force_flash: false,
|
|
// flip_horiz: true,
|
|
// fps: 45
|
|
});
|
|
|
|
Webcam.attach( '#my_camera' );
|
|
|
|
$("#snap").click(snap);
|
|
|
|
}
|
|
|
|
function snap(){
|
|
Webcam.snap( function(data_uri) {
|
|
document.getElementById('my_result').innerHTML = '<img width="160" height="120" src="'+data_uri+'"/>';
|
|
|
|
var raw_image_data = data_uri.replace(/^data\:image\/\w+\;base64\,/, '');
|
|
|
|
document.getElementById(defaults.image_data ).value = raw_image_data;
|
|
|
|
} );
|
|
}
|
|
|
|
} |