Line | |
---|
1 | <?php
|
---|
2 | // Example 9 : QR Barcode with data read from file and different colors
|
---|
3 |
|
---|
4 | // Include the library
|
---|
5 | require_once ('jpgraph/jpgraph.php');
|
---|
6 | require_once ('jpgraph/QR/qrencoder.inc.php');
|
---|
7 |
|
---|
8 | $readFromFilename = 'qr-input.txt';
|
---|
9 |
|
---|
10 | // Create a new instance of the encoder and let the library
|
---|
11 | // decide a suitable QR version and error level
|
---|
12 | $encoder = new QREncoder();
|
---|
13 |
|
---|
14 | // Use the image backend
|
---|
15 | $backend = QRCodeBackendFactory::Create($encoder, BACKEND_IMAGE);
|
---|
16 |
|
---|
17 | // Set the module size (quite big)
|
---|
18 | $backend->SetModuleWidth(5);
|
---|
19 |
|
---|
20 | // Use blue and white colors instead
|
---|
21 | $backend->SetColor('navy','white');
|
---|
22 |
|
---|
23 | // .. send the barcode back to the browser for the data in the file
|
---|
24 | $backend->StrokeFromFile($readFromFilename);
|
---|
25 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.