gente ao tirar a foto preciso converter a imagem para base 64.
Webcam.set({
// live preview size
width: 320,
height: 190,
// device capture size
dest_width: 620,
dest_height: 460,
// final cropped size
crop_width: 460,
crop_height: 460,
// format and quality
image_format: 'jpeg',
jpeg_quality: 90,
// flip horizontal (mirror mode)
flip_horiz: true
});
Webcam.attach( '#my_camera' );
}
//Ativar/Desativar Webcam
var shutter = new Audio();
shutter.autoplay = false;
shutter.src = navigator.userAgent.match(/Firefox/) ? 'shutter.ogg' : 'shutter.mp3';
function TirarFoto() {
document.getElementById('TirarFoto').style.display="none";
document.getElementById('ErroFoto').style.display="block";
try { shutter.currentTime = 0; } catch(e) {;}
shutter.play();
Webcam.freeze();
}
function draw(v,c,w,h) {
}
function CacelarFoto() {
// cancela a visualização da foto
Webcam.unfreeze();
document.getElementById('Ligar').style.display="block";
document.getElementById('anexar').style.display="block";
document.getElementById('TirarFoto').style.display="none";
document.getElementById('ErroFoto').style.display="none";
}
<div id="my_camera" class="hidden-xs" style="float:right;margin-top:-80px; height: 190px; width: 237px;">
</div>
<div style="float:right; margin-top:112px; margin-right: -160px;" class="hidden-xs" >
<a class="btn btn-success" id="Ligar" onclick="LigarCamera()" role="button" aria-pressed="true">
<i class="fas fa-camera"></i></a>
<a class="btn btn-success" id="TirarFoto" onclick="TirarFoto()" role="button" aria-pressed="true">
<i class="fas fa-thumbs-up"></i></a>
<span class="btn btn-info btn-file" id="anexar">
<input type="file"> <i class="fas fa-paperclip"></i>
</span>
<a class="btn btn-danger" id="ErroFoto" onclick="CacelarFoto()" role="button" aria-pressed="true"><i class="fas fa-thumbs-down"></i></i></a>
</div>