prestation/faceebene/ebenetraitementimage.php
2025-12-05 10:42:46 +00:00

140 lines
5.6 KiB
PHP
Executable File

<?php
$_SESSION['p_messageFace'] = "";
?>
<div class="modal fade" id="pop_rec_faciale" role="dialog" data-backdrop="static" data-keyboard="false" >
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button id="btn_close_pop_rec_faciale" name="btn_close_pop_rec_faciale" type="button" class="close" data-bs-dismiss="modal" onclick="javascript:fiche_beneficiaire();"> <?= _("Fermer") ?> </button>
<h4 class="modal-title"> <?= _("RECONNAISSANCE FACIALE") ?> </h4>
</div>
<div class="modal-body">
<table class="table table-responsive table-condensed">
<tbody>
<tr>
<td width="48%">
<button id="ebene_take_photo_face" name="ebene_take_photo_face" style='font-size:15pt;' type="button" class="form-control btn btn-primary" onclick="javascript:takephoto();"> <?= _("PRENDRE UNE PHOTO") ?> </button>
</td>
<td > </td>
<?php if ($faceRegistered=="1") : ?>
<td width="48%">
<button disabled id="ebene_confirmer_photo_face" name="ebene_confirmer_photo_face" style='font-size:15pt;' type="button" class="form-control btn btn-primary" onclick="javascript:ebene_confirmer_photo_face();"> <?= _("CONFIRMER LA PHOTO") ?> </button>
</td>
<?php endif; ?>
<?php if ($faceRegistered!="1") : ?>
<td width="48%">
<button disabled id="ebene_enregistrer_photo_face" name="ebene_enregistrer_photo_face" style='font-size:15pt;' type="button" class="form-control btn btn-primary" onclick="javascript:ebene_enregistrer_photo_face();"> <?= _("ENREGISTRER LA PHOTO") ?> </button>
</td>
<?php endif; ?>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-6" >
<legend style="text-align:center" >Webcam</legend>
<video id="video_face" name="video_face" autoplay 350="450" height="250" align="center"></video><br />
</div>
<div class="col-6" >
<legend style="text-align:center" >Photo</legend>
<img id="photo_face" name="photo_face" src="" />
<form id="form_face" name="form_face" enctype="multipart/form-data" method="post" action="Fichebeneficiaire/ebeneenregistrerface">
<INPUT class="sr-only" TYPE="text" id="compare_face" name="compare_face" value="<?= $faceRegistered ?>">
<INPUT class="sr-only" TYPE="text" id="del_face" name="del_face" value="0">
<INPUT class="image-tag" TYPE="hidden" id="image_face" name="image_face" >
</form>
</div>
</div>
<canvas id="canvas" name="canvas" style="display: none;" width="350" height="260"></canvas>
<?php if ($faceRegistered=="1") : ?>
<!--
<button disabled id="ebene_supprimer_photo_face" name="ebene_supprimer_photo_face" style='font-size:15pt;' type="button" class="form-control btn btn-danger" onclick="javascript:ebene_supprimer_photo_face();"> <?= _("SUPPRIMER LA PHOTO") ?> </button>
<span style='font-size:12pt;font-weight: bold;' ><?= _("Motif Suppression") ?> :</span> <INPUT disabled class="form-control" TYPE="text" id="motif" NAME="motif" style='font-size:12pt;font-weight: bold;' >
-->
<?php endif; ?>
<div id="message_face" name="message_face" >
<H2 style="background-color:yellow;">
<marquee behavior="scroll" direction="left" scrollamount="10"> </marquee>
</H2>
<INPUT class="sr-only" TYPE="text" id="photo_succes" name="photo_succes" value="0">
</div>
<div id="div_wait_face_ebene">
</div>
<script type="text/javascript">
var video = document.getElementById('video_face');
var canvas = document.getElementById('canvas');
var photo = document.getElementById('photo_face');
var image_face = document.getElementById('image_face');
navigator.getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.mediaDevices.getUserMedia || navigator.moxGetUserMedia;
if (navigator.mediaDevices.getUserMedia)
{
navigator.mediaDevices.getUserMedia({video: true })
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (e) { alert(e.name + ": " + e.message); });
}
else
{
navigator.getMedia({ video: { mandatory: { maxWidth: 350, maxHeight: 260 } } }, function(stream) {
video.src = stream;
}, function(e) {
alert(e);
console.log("Failed!", e);
});
}
function takephoto() {
$('#message_face').html("");
$("#div_wait_face_ebene").html('');
// var ctx = canvas.getContext("2d").drawImage(video, 0, 0, 350, 260, 0, 0, 350, 260);
var ctx = canvas.getContext("2d").drawImage(video, 0, 0, 350, 260);
var data = canvas.toDataURL('image/jpeg');
// var data = canvas.toDataURL('image/jpeg', 0.7);
photo.setAttribute('src', data);
$("#image_face").val(data);
var faceRegistered = $("#faceRegistered").val();
$("#ebene_enregistrer_photo_face").enable();
if(faceRegistered=="1")
{
$("#ebene_confirmer_photo_face").enable();
$("#ebene_supprimer_photo_face").enable();
$("#motif").enable();
}
}
</script>
</div>
<div class="modal-footer">
<button id="close_poprec_faciane" name="close_poprec_faciane" type="button" class="btn btn-default" data-bs-dismiss="modal" onclick="javascript:fiche_beneficiaire();" > <?= _("Fermer") ?> </button>
</div>
</div>
</div>
</div>