-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQrcodeTemplate.php
More file actions
87 lines (64 loc) · 1.37 KB
/
QrcodeTemplate.php
File metadata and controls
87 lines (64 loc) · 1.37 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Created by PhpStorm.
* User: sasika
* Date: 5/20/2018
* Time: 10:56 PM
*/
require_once ("Address.php");
class QrcodeTemplate
{
public $url = "";
public $name = "";
public $email = "";
public $telephone = "";
public $address = "";
/***
* @param $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/***
* @param $name
*/
public function setName($name)
{
$this->name = $name;
}
/***
* @param $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/***
* @param $telePhone
*/
public function setTelePhone($telePhone)
{
$this->telephone = $telePhone;
}
/***
* @param Address $address
*/
public function setAddress(Address $address)
{
$this->address = $address;
}
/***
* create-qr-code
* @return string
*/
public function createQrCode(){
$qrId = uniqid("qrCode");
$filepath = "images/$qrId.png";
$codeContents = "name: $this->name , email: $this->email , telephone: $this->telephone , address: $this->address , url: $this->url";
QRcode::png($codeContents, $filepath, QR_ECLEVEL_H, 10);
$QR = imagecreatefrompng($filepath);
imagepng($QR, $filepath);
return $filepath;
}
}