Line | |
---|
1 | <?php
|
---|
2 | require_once ('jpgraph/QR/qrencoder.inc.php');
|
---|
3 |
|
---|
4 | // Data to be encoded
|
---|
5 | $data = 'ABCDEFGH01234567';
|
---|
6 |
|
---|
7 | // QR Code specification
|
---|
8 | $version = -1; // -1 = Let the library decide version (same as default)
|
---|
9 | $corrlevel = QRCapacity::ErrM; // Medium erro correction
|
---|
10 | $modulewidth = 2; // Module width
|
---|
11 | $back = BACKEND_IMAGE; // Default backend
|
---|
12 | $quiet = 4; // Same as default value
|
---|
13 |
|
---|
14 | // Create encoder and backend
|
---|
15 | $encoder = new QREncoder($version, $corrlevel);
|
---|
16 | $backend = QRCodeBackendFactory::Create($encoder, $back);
|
---|
17 |
|
---|
18 | // Set the module size
|
---|
19 | $backend->SetModuleWidth($modulewidth);
|
---|
20 |
|
---|
21 | // Set Quiet zone (this should rarely need changing from the default)
|
---|
22 | $backend->SetQuietZone($quiet);
|
---|
23 |
|
---|
24 | if( $back == BACKEND_IMAGE ) {
|
---|
25 |
|
---|
26 | $backend->Stroke($data);
|
---|
27 | }
|
---|
28 | else {
|
---|
29 | $str = $backend->Stroke($data);
|
---|
30 | echo '<pre>'.$str.'</pre>';
|
---|
31 | }
|
---|
32 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.