A Web based statistic Tool for Photobooth by andreknieriem
https://github.com/andreknieriem/photobooth
- In public_html is all the Web Code.
- Change the API-Key
$api_key_value = "<key>";
in api/post-esp-data.php - In the folder mysql is MYSQL dump. This dump is an example.
- Install php-curl ->
sudo apt-get install php-curl
ATTENTION
The following photobooth configuration must be adjusted:
- Change the API-Url
https://yourdomain.com/api/post-esp-data.php
and API-Key in print.php and takePic.php
Frist add function:
function writeToDB($filename)
{
# POST TO DB
$postRequest = array(
'api_key' => '<password>',
'sensor' => 'print',
'printName' => $filename
);
$cURLConnection = curl_init('<url>');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);
}
Call the function
writeToDB($filename);
befor
die(json_encode([
'status' => 'ok',
'msg' => $printimage || ,
]));
Frist add function:
function writeToDB($file)
{
# POST TO DB
$postRequest = array(
'api_key' => '<password>',
'sensor' => 'photo',
'photoName' => $file
);
$cURLConnection = curl_init('<url>');
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);
}
Call the function:
if ($number == 3) {
writeToDB($file);
}
after
takePicture($filename);
Call the function:
writeToDB($file);
befor
// send imagename to frontend
echo json_encode([
'success' => 'image',
'file' => $file,
]);