tools for generating cards
This commit is contained in:
parent
5505e23754
commit
a2c86b587b
2 changed files with 32 additions and 0 deletions
23
tools/get_employees.php
Normal file
23
tools/get_employees.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
include '../src/osvobdoch_vars.php';
|
||||
include '../src/osvobdoch_local_vars.php';
|
||||
$metoda = "GET";
|
||||
$cesta = "/api/dochazka/v2/pracovnici";
|
||||
# cas "2016-09-30 11:54:12.637";
|
||||
date_default_timezone_set('Europe/Prague');
|
||||
$cas= date("Y-m-d H:i:s");
|
||||
$data = $metoda ."+".$cesta . "+" . $cas . "+" . $apiheslo;
|
||||
$hash = hash_hmac("sha1", $data, $key, $raw_output=false);
|
||||
$auth = $apiuser . ":" . $hash;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url.$cesta);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $metoda);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
"com.edookit.Time: ".$cas,
|
||||
"com.edookit.Auth: ".$auth,
|
||||
"com.edookit.Client: ".$id
|
||||
));
|
||||
$result = curl_exec($ch);
|
||||
echo $result;
|
||||
?>
|
9
tools/process.bash
Executable file
9
tools/process.bash
Executable file
|
@ -0,0 +1,9 @@
|
|||
!#/bin/bash
|
||||
cat students.json | jq -c '.Zaci[]|{id: .PkZak, name: .Jmeno, surname: .Prijmeni }' | while read line; do
|
||||
id=$(echo $line | jq -r '.id')
|
||||
name=$(echo $line | jq -r '.name')
|
||||
surname=$(echo $line | jq -r '.surname')
|
||||
echo "Processing $name $surname "
|
||||
qrencode -o "qrcodes/$id.png" $line
|
||||
convert -size 1000x640 xc:white templates/background.png -geometry 500x460+0+200 -composite templates/logo.png -geometry 420x100+40+40 -composite -background transparent -fill black -size 420x240 -font templates/Quicksand-VariableFont_wght.ttf caption:"$name\n$surname" -geometry +40+220 -composite qrcodes/$id.png -geometry 420x420+540+140 -composite "cards/$name-$surname.png"
|
||||
done
|
Loading…
Reference in a new issue