source: trunk/xgraph/jpgraph/Examples/qrexample06.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 877 bytes
Line 
1<?php
2    // Example 6 : QR Barcode with image in JPG format
3
4    // Include the library
5    require_once ('jpgraph/QR/qrencoder.inc.php');
6
7    $data      = 'ABCDEFGH01234567'; // Data to be encoded
8    $version   = -1;  // -1 = Let the library decide version (same as default)
9    $corrlevel = -1; // -1 = Let the library decide error correction level (same as default)
10
11    // Create a new instance of the encoder using the specified
12    // QR version and error correction
13    $encoder = new QREncoder($version,$corrlevel);
14
15    // Use the image backend
16    $backend=QRCodeBackendFactory::Create($encoder, BACKEND_IMAGE);
17
18    // Use JPEG format with 80% quality level
19    $backend->SetImgFormat('jpeg',80);
20
21    // Set the module size
22    $backend->SetModuleWidth(4);
23
24    // Store the barcode in the specifed file
25    $backend->Stroke($data);
26?>
Note: See TracBrowser for help on using the repository browser.