-
Notifications
You must be signed in to change notification settings - Fork 0
/
QRCode_generator.php
46 lines (39 loc) · 1.03 KB
/
QRCode_generator.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
<?php
require_once ("config.php");
class QrcodeTemplate
{
public $url = "";
public $name = "";
public $email = "";
public $telephone = "";
public $address = "";
public function setUrl($url)
{
$this->url = $url;
}
public function setName($name)
{
$this->name = $name;
}
public function setEmail($email)
{
$this->email = $email;
}
public function setTelePhone($telePhone)
{
$this->telephone = $telePhone;
}
public function setAddress(Address $address)
{
$this->address = $address;
}
public function createQrCode(){
$qrId = uniqid("QRCode");
$filepath = "img/$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;
}
}