-
Notifications
You must be signed in to change notification settings - Fork 0
/
qrgen.php~
73 lines (45 loc) · 977 Bytes
/
qrgen.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
72
73
<?php
require_once('helper_funcs.php');
require_once("defs.php");
require_once("db.php");
require_once("pdf_renderer.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',9);
$pdf->SetTextColor(255,0,0);
//$pdf->Cell(40,10,'Hello World!');
$pw = 210;
$ph = 297;
$dir = 'qritems';
$files = scandir($dir);
$files = array_slice($files, 2);
//print_r($files);
//line to load file
$numRows = 4;
$numCols = 3;
$xCount = 0;
$yCount = 0;
$w = $pw / $numCols;
$h = $ph / $numRows;
$lblXPos = 0;
$lblYPos = 0;
foreach($files as $k){
if($xCount == $numCols){
$xCount = 0;
$yCount ++;
}
if($yCount == $numRows){
$pdf->AddPage();
$yCount = 0;
}
$fname = 'qritems/' . $k;
$pdf->Image($fname,$xCount * $w,$yCount * $h, $w, $h);
$pdf->SetXY(($xCount * $w) + 5, $yCount * $h );
$pieces = explode("_", $k);
$itemName = $pieces[0]; // piece1
$pdf->Cell($w,10,$itemName);
$xCount++;
}
$pdf->Output();
//echo 'okay';
?>