Main class to create QR-code. More...
Public Member Functions | |
encodeMask (QRinput $input, $mask) | |
Encode mask Main function responsible for creating code. More... | |
encodeInput (QRinput $input) | |
Encode input with mask detection. More... | |
encodeString8bit ($string, $version, $level) | |
Encode string, forcing 8-bit encoding. More... | |
encodeString ($string, $version, $level, $hint, $casesensitive) | |
Encode string, using optimal encodings. More... | |
Static Public Member Functions | |
static | png ($text, $outfile=false, $level=QR_ECLEVEL_L, $size=3, $margin=4, $saveandprint=false) |
Creates PNG image containing QR-Code. More... | |
static | text ($text, $outfile=false, $level=QR_ECLEVEL_L, $size=3, $margin=4) |
Creates text (1's & 0's) containing QR-Code. More... | |
static | raw ($text, $outfile=false, $level=QR_ECLEVEL_L, $size=3, $margin=4) |
Creates Raw Array containing QR-Code. More... | |
static | canvas ($text, $elemId=false, $level=QR_ECLEVEL_L, $width=false, $size=false, $margin=4, $autoInclude=false) |
Creates Html+JS code to draw QR-Code with HTML5 Canvas. More... | |
static | svg ($text, $elemId=false, $outFile=false, $level=QR_ECLEVEL_L, $width=false, $size=false, $margin=4, $compress=false) |
Creates SVG with QR-Code. More... | |
Public Attributes | |
$version | |
Integer QR code version. Size of QRcode is defined as version. Version is from 1 to 40. Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix. | |
$width | |
Integer Width of code table. Because code is square shaped - same as height. | |
$data | |
Array Ready, masked code data. | |
Static Public Attributes | |
static | $jscanvasincluded = false |
Canvas JS include flag. More... | |
Main class to create QR-code.
QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004.
Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.
Class for generating QR-code images, SVG and HTML5 Canvas
|
static |
Creates Html+JS code to draw QR-Code with HTML5 Canvas.
Simple helper function to create QR-Code array with one static call.
String | $text | text string to encode |
String | $elemId | (optional) target Canvas tag id attribute, if false Canvas tag with auto id will be created |
Integer | $level | (optional) error correction level QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_Q or QR_ECLEVEL_H |
Integer | $width | (optional) CANVAS element width (sam as height) |
Integer | $size | (optional) pixel size, multiplier for each 'virtual' pixel |
Integer | $margin | (optional) code margin (silent zone) in 'virtual' pixels |
Boolean | $autoInclude | (optional) if true, required qrcanvas.js lib will be included (only once) |
QRcode::encodeInput | ( | QRinput | $input) |
Encode input with mask detection.
Shorthand for encodeMask, without specifing particular, static mask number.
QRinput | $input | data object to be encoded |
QRcode::encodeMask | ( | QRinput | $input, |
$mask | |||
) |
Encode mask Main function responsible for creating code.
We get empty frame, then fill it with data from input, then select best mask and apply it. If $mask argument is greater than -1 we assume that user want's that specific mask number (ranging form 0-7) to be used. Otherwise (when $mask is -1) mask is detected using algorithm depending of global configuration,
QRinput | $input | data object |
Integer | $mask | sugested masking mode |
QRcode::encodeString | ( | $string, | |
$version, | |||
$level, | |||
$hint, | |||
$casesensitive | |||
) |
Encode string, using optimal encodings.
Encode string dynamically adjusting encoding for subsections of string to minimize resulting code size. For complex string it will split string into subsections: Numerical, Alphanumerical or 8-bit.
String | $string | input string |
Integer | $version | code version (size of code area) |
String | $level | ECC level (see: Global Constants -> Levels of Error Correction) |
Integer | $hint | QR_MODE_8 or QR_MODE_KANJI, Because Kanji encoding is kind of 8 bit encoding we need to hint encoder to use Kanji mode explicite. (otherwise it may try to encode it as plain 8 bit stream) |
Boolean | $casesensitive | hint if given string is case-sensitive, because if not - encoder may use optimal QR_MODE_AN instead of QR_MODE_8 |
QRcode::encodeString8bit | ( | $string, | |
$version, | |||
$level | |||
) |
Encode string, forcing 8-bit encoding.
String | $string | input string |
Integer | $version | code version (size of code area) |
Integer | $level | ECC level (see: Global Constants -> Levels of Error Correction) |
|
static |
Creates PNG image containing QR-Code.
Simple helper function to create QR-Code Png image with one static call.
String | $text | text string to encode |
String | $outfile | (optional) output file name, if false outputs to browser with required headers |
Integer | $level | (optional) error correction level QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_Q or QR_ECLEVEL_H |
Integer | $size | (optional) pixel size, multiplier for each 'virtual' pixel |
Integer | $margin | (optional) code margin (silent zone) in 'virtual' pixels |
Boolean | $saveandprint | (optional) if true code is outputed to browser and saved to file, otherwise only saved to file. It is effective only if $outfile is specified. |
|
static |
Creates Raw Array containing QR-Code.
Simple helper function to create QR-Code array with one static call.
String | $text | text string to encode |
Boolean | $outfile | (optional) not used, shuold be false |
Integer | $level | (optional) error correction level QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_Q or QR_ECLEVEL_H |
Integer | $size | (optional) pixel size, multiplier for each 'virtual' pixel |
Integer | $margin | (optional) code margin (silent zone) in 'virtual' pixels |
|
static |
Creates SVG with QR-Code.
Simple helper function to create QR-Code SVG with one static call.
String | $text | text string to encode |
Boolean | $elemId | (optional) target SVG tag id attribute, if false SVG tag with auto id will be created |
String | $outfile | (optional) output file name, when false file is not saved |
Integer | $level | (optional) error correction level QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_Q or QR_ECLEVEL_H |
Integer | $width | (optional) SVG element width (sam as height) |
Integer | $size | (optional) pixel size, multiplier for each 'virtual' pixel |
Integer | $margin | (optional) code margin (silent zone) in 'virtual' pixels |
Boolean | $compress | (optional) if true, compressed SVGZ (instead plaintext SVG) is saved to file |
|
static |
Creates text (1's & 0's) containing QR-Code.
Simple helper function to create QR-Code text with one static call.
String | $text | text string to encode |
String | $outfile | (optional) output file name, when false file is not saved |
Integer | $level | (optional) error correction level QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_Q or QR_ECLEVEL_H |
Integer | $size | (optional) pixel size, multiplier for each 'virtual' pixel |
Integer | $margin | (optional) code margin (silent zone) in 'virtual' pixels |
|
static |
Canvas JS include flag.
If canvas js support library was included, we remember it static in QRcode. (because file should be included only once)