-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdetect.php
More file actions
27 lines (20 loc) · 705 Bytes
/
detect.php
File metadata and controls
27 lines (20 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
include "bootstrap.php";
$data = json_decode($face->getFaces(convertBase64PhotoToBinary($_POST["photo"])));
if(count($data)) {
$faceIds = [];
foreach($data as $_face) {
$faceIds[] = $_face->faceId;
}
$result = $face->identify($faceIds);
$data = json_decode($result);
if($data) {
if(!isset($data[0]->candidates) || count($data[0]->candidates) == 0) {
echo "This user is unknown (not VIP / returning customer, probably)";
} else {
echo "<br /><span style='color: red; font-weight: bold;'>BEWARE! This user might be VIP / returning customer (confidence: ". $data[0]->candidates[0]->confidence . ").</span>";
}
}
} else {
echo "Face not recognized.";
}