-
Notifications
You must be signed in to change notification settings - Fork 0
/
alternative_func.php
71 lines (59 loc) · 1.58 KB
/
alternative_func.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
require_once 'vendor/codecrafted/iron-elephant/src/heart.php';
require_once 'vendor/autoload.php';
require_once 'config.php';
/**
* Add your custom functions
*/
// Redirect to index.php page
function finish($tag_id = '')
{
redirect(WEB_ADDRESS . "/#$tag_id");
die;
}
// Redirect to analyze.php page
function analyze_finish($tag_id)
{
redirect(WEB_ADDRESS . "/analyze.php#$tag_id");
die;
}
function et(string $str)
{
if (empty(trim($str))) {
return true;
} else {
return false;
}
}
/**
* Create QR code
*/
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\Label\LabelAlignment;
use Endroid\QrCode\Label\Font\NotoSans;
use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
function qr($value, $label)
{
$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data($value)
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(ErrorCorrectionLevel::High)
->size(300)
->margin(10)
->roundBlockSizeMode(RoundBlockSizeMode::Margin)
->logoPath(__DIR__ . '/resources/fav/android-chrome-512x512.png')
->logoResizeToWidth(50)
->logoPunchoutBackground(true)
->labelText($label)
->labelFont(new NotoSans(20))
->labelAlignment(LabelAlignment::Center)
->validateResult(false)
->build();
// Generate a data URI to include image data inline (i.e. inside an <img> tag)
return $result->getDataUri();
}