-
Notifications
You must be signed in to change notification settings - Fork 2
/
datamatriximg.php
57 lines (46 loc) · 1.37 KB
/
datamatriximg.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
<?php
//============================================================+
// File name : datamatriximg.php
// Version : 0.0.1
// Begin : 2014-12-09
// Last Update : 2014-12-09
//* @author Anatoly Smirnov
//* @version 0.0.1
// -------------------------------------------------------------------
// -------------------------------------------------------------------
//
// DESCRIPTION :
//
// Class to generate Datamatrix image, format png.
//============================================================+
/**
* @file
* Class to generate Datamatrix image, format png.
* @author Anatoly Smirnov
* @version 0.0.1
*/
/**
* @class PostForm
* Class to generate Datamatrix image, format png.
* @author Anatoly Smirnov
* @version 0.0.1
*/
class DatamatrixImage {
/**
* create Datamatrix image
* @param $data (string) data to encode in datamatrix.
* @param $img (string) path to image file.
* @param $size (int) size of one elementary element in pixel.
* @return bool result of operation
* @public
*/
public function getDatamatrixImg($data, $img, $size){
$barcodeobj = new TCPDF2DDatamatrixBarcode($data);
// output the barcode as PNG image
$png = $barcodeobj->getBarcodePngData($size, $size, array(0,0,0));
if (file_put_contents($img, $png)) {
return true;
}
return false;
}
}