Line | |
---|
1 | <?php |
---|
2 | // Example 5 : QR Barcode with manually specified encodation |
---|
3 | |
---|
4 | // Include the library |
---|
5 | require_once ('jpgraph/QR/qrencoder.inc.php'); |
---|
6 | |
---|
7 | // Data to be encoded |
---|
8 | // We want the data to be encoded using alphanumeric encoding even though |
---|
9 | // it is only numbers |
---|
10 | $data = array( |
---|
11 | array(QREncoder::MODE_ALPHANUM,'01234567') |
---|
12 | ); |
---|
13 | |
---|
14 | $version = 3; // Use QR version 3 |
---|
15 | $corrlevel = QRCapacity::ErrH ; // Level H error correction (the highest possible) |
---|
16 | |
---|
17 | // Create a new instance of the encoder using the specified |
---|
18 | // QR version and error correction |
---|
19 | $encoder = new QREncoder($version,$corrlevel); |
---|
20 | |
---|
21 | // Use the image backend |
---|
22 | $backend = QRCodeBackendFactory::Create($encoder, BACKEND_IMAGE); |
---|
23 | |
---|
24 | // Set the module size |
---|
25 | $backend->SetModuleWidth(4); |
---|
26 | |
---|
27 | // Store the barcode in the specifed file |
---|
28 | $backend->Stroke($data); |
---|
29 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.