Image_QRCode
[ class tree: Image_QRCode ] [ index: Image_QRCode ] [ all elements ]

Class: Image_QRCode

Source Location: /Image_QRCode-0.1.3/Image/QRCode.php

Class Overview


QRCode


Author(s):

Version:

  • Release: 0.1

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 66]
QRCode


[ Top ]


Class Variables

$alphanumeric_hash = array(
        "0"=>0,"1"=>1,"2"=>2,"3"=>3,"4"=>4,
        "5"=>5,"6"=>6,"7"=>7,"8"=>8,"9"=>9,"A"=>10,"B"=>11,"C"=>12,"D"=>13,"E"=>14,
        "F"=>15,"G"=>16,"H"=>17,"I"=>18,"J"=>19,"K"=>20,"L"=>21,"M"=>22,"N"=>23,
        "O"=>24,"P"=>25,"Q"=>26,"R"=>27,"S"=>28,"T"=>29,"U"=>30,"V"=>31,
        "W"=>32,"X"=>33,"Y"=>34,"Z"=>35," "=>36,'$'=>37,"%"=>38,"*"=>39,
        "+"=>40,"-"=>41,"."=>42,"/"=>43,":"=>44
    )

[line 156]

lookup table for alphanumeric characters Note: the '$' index is in single quotes as otherwise PHP tries to parse it as a variable (see PEAR bug #17321)
  • Access: protected

Type:   array


[ Top ]

$base_image =

[line 126]

base_image
  • Access: protected

Type:   gd_image


[ Top ]

$byte_num =

[line 338]

Byte number counter
  • Access: protected

Type:   integer


[ Top ]

$codewords =

[line 282]

Codewords calculated prior to matrix generation
  • Access: protected

Type:   array


[ Top ]

$codeword_num_counter_value =

[line 261]

Codeword pointer, incremental
  • Access: protected

Type:   integer


[ Top ]

$codeword_num_plus =

[line 268]

Codeword details
  • Access: protected

Type:   array


[ Top ]

$data_bits =

[line 254]

Data bits array
  • Access: protected

Type:   array


[ Top ]

$data_counter =

[line 247]

Incremental counter, pointer into the data arrays
  • Access: protected

Type:   integer


[ Top ]

$data_string =

[line 102]

string/data to encode
  • Access: protected

Type:   string


[ Top ]

$data_value =

[line 240]

Data values
  • Access: protected

Type:   array


[ Top ]

$error_correct =

[line 147]

Error correction indicator
  • Access: protected

Type:   string


[ Top ]

$format_array = array(
        "101010000010010","101000100100101",
        "101111001111100","101101101001011","100010111111001","100000011001110",
        "100111110010111","100101010100000","111011111000100","111001011110011",
        "111110110101010","111100010011101","110011000101111","110001100011000",
        "110110001000001","110100101110110","001011010001001","001001110111110",
        "001110011100111","001100111010000","000011101100010","000001001010101",
        "000110100001100","000100000111011","011010101011111","011000001101000",
        "011111100110001","011101000000110","010010010110100","010000110000011",
        "010111011011010","010101111101101"
    )

[line 209]

Formatting data for the final barcode
  • Access: protected

Type:   array


[ Top ]

$image_path =

[line 81]

path to the image directory
  • Access: protected

Type:   string


[ Top ]

$image_type =

[line 119]

image_type
  • png/jpeg

  • Access: protected

Type:   string


[ Top ]

$mask_array =

[line 317]

Masking array - used in final matrix generation
  • Access: protected

Type:   array


[ Top ]

$matrix_content =

[line 296]

Final matrix details for plotting barcode
  • Access: protected

Type:   array


[ Top ]

$matrix_x_array =

[line 303]

Matrix X array
  • Access: protected

Type:   array


[ Top ]

$matrix_y_array =

[line 310]

Matrix Y array
  • Access: protected

Type:   array


[ Top ]

$max_codewords_array = array(
        0,26,44,70,100,134,172,196,242,
        292,346,404,466,532,581,655,733,815,901,991,1085,1156,
        1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,
        2611,2761,2876,3034,3196,3362,3532,3706
    )

[line 197]

Maximum number of codewords, dependant on barcode version
  • Access: protected

Type:   array


[ Top ]

$max_data_bits =

[line 226]

Maximum number of data bits
  • Access: protected

Type:   integer


[ Top ]

$max_data_bits_array = array(
        0,128,224,352,512,688,864,992,1232,1456,1728,
        2032,2320,2672,2920,3320,3624,4056,4504,5016,5352,
        5712,6256,6880,7312,8000,8496,9024,9544,10136,10984,
        11640,12328,13048,13800,14496,15312,15936,16816,17728,18672,

        152,272,440,640,864,1088,1248,1552,1856,2192,
        2592,2960,3424,3688,4184,4712,5176,5768,6360,6888,
        7456,8048,8752,9392,10208,10960,11744,12248,13048,13880,
        14744,15640,16568,17528,18448,19472,20528,21616,22496,23648,

        72,128,208,288,368,480,528,688,800,976,
        1120,1264,1440,1576,1784,2024,2264,2504,2728,3080,
        3248,3536,3712,4112,4304,4768,5024,5288,5608,5960,
        6344,6760,7208,7688,7888,8432,8768,9136,9776,10208,

        104,176,272,384,496,608,704,880,1056,1232,
        1440,1648,1952,2088,2360,2600,2936,3176,3560,3880,
        4096,4544,4912,5312,5744,6032,6464,6968,7288,7880,
        8264,8920,9368,9848,10288,10832,11408,12016,12656,13328
    )

[line 170]

Maximum data bits lookup
  • Access: protected

Type:   array


[ Top ]

$max_data_codewords =

[line 289]

Maximum number of data codewords
  • Access: protected

Type:   integer


[ Top ]

$module_size =

[line 233]

Size of the module
  • Access: protected

Type:   integer


[ Top ]

$output_image =

[line 133]

output image
  • Access: protected

Type:   gd_image


[ Top ]

$output_type =

[line 111]

output type
  • return: return raw PHP GD image object
  • display: output to browser

  • Access: protected

Type:   string


[ Top ]

$path =

[line 74]

path to the data directory
  • Access: protected

Type:   string


[ Top ]

$rs_block_order =

[line 324]

RS Block order array
  • Access: protected

Type:   array


[ Top ]

$rs_cal_table_array =

[line 331]

RS Calculation table array
  • Access: protected

Type:   array


[ Top ]

$rs_ecc_codewords =

[line 275]

RS-ECC codewords
  • Access: protected

Type:   string


[ Top ]

$structureappend_m =

[line 352]

Structured append 'm' value
  • Access: protected

Type:   integer


[ Top ]

$structureappend_n =

[line 345]

Structured append 'n' value
  • Access: protected

Type:   integer


[ Top ]

$structureappend_originaldata =

[line 366]

Structured append original data
  • Access: protected

Type:   string


[ Top ]

$structureappend_parity =

[line 359]

Structured append parity value
  • Access: protected

Type:   integer


[ Top ]

$total_data_bits =

[line 140]

total number of data bits
  • Access: protected

Type:   integer


[ Top ]

$version =

[line 88]

version of QRCode to use
  • Access: protected

Type:   integer


[ Top ]

$version_ul =

[line 95]

upper limit for version
  • Access: protected

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 373]

Image_QRCode __construct( [array $options = array()])

Class constructor
  • Access: public

Parameters:

array   $options   —  An array of options for the class

[ Top ]

addMatrixToImage   [line 1416]

void addMatrixToImage( integer $max_modules_1side, integer $mask_content)

Adds the calculated matrix data to the base image.
  • Access: protected

Parameters:

integer   $max_modules_1side   —  Max number of modules (single side)
integer   $mask_content   —  Mask based on original data

[ Top ]

applyStructureAppend   [line 1163]

void applyStructureAppend( )

Adds m/n and parity data for structure append (if supplied)
  • Access: protected

[ Top ]

attachCodewordData   [line 1214]

void attachCodewordData( integer $max_codewords, integer $matrix_remain_bit)

Attaches the calculated codeword data to the data matrix
  • Access: protected

Parameters:

integer   $max_codewords   —  Maximum number of codewords for this code
integer   $matrix_remain_bit   —  Dependant on the version of the code

[ Top ]

calculateFormatInformation   [line 1052]

void calculateFormatInformation( array $format_info, integer $mask_number)

Calculates the format information for the barcode
  • Access: protected

Parameters:

array   $format_info   —  format information from data files
integer   $mask_number   —  mask integer to use

[ Top ]

checkVersion   [line 704]

void checkVersion( )

Performs version checking/calculation
  • Throws: Image_QRCode_Exception
  • Access: protected

[ Top ]

createBaseImage   [line 1381]

integer createBaseImage( integer $max_modules_1side)

Creates the base square image, based on the module size
  • Access: protected

Parameters:

integer   $max_modules_1side   —  Max number of modules (single side)

[ Top ]

createOutputImage   [line 1142]

void createOutputImage( integer $mib)

Creates the final GD output image block ready for sending wherever the user desires
  • Access: protected

Parameters:

integer   $mib   —  destination image width/height

[ Top ]

determineEncoding   [line 741]

void determineEncoding( )

Determines the encoding needed for the data provided
  • Access: protected

[ Top ]

divideBy8Bit   [line 965]

integer divideBy8Bit( )

Gets data into 8-bit format
  • Access: protected

[ Top ]

doRSCalculations   [line 1076]

void doRSCalculations( )

Perform the actual RS calculations on the data
  • Access: protected

[ Top ]

emptyMatrix   [line 1361]

void emptyMatrix( integer $max_modules_1side)

Clears the output matrix array, ready for new data
  • Access: protected

Parameters:

integer   $max_modules_1side   —  Max number of modules (single side)

[ Top ]

makeCode   [line 570]

resource makeCode( [string $data = ""], [array $options = array()], [array $append = array()])

Performs all necessary calculations and returns/outputs an image as defined by the configuration
  • Throws: Image_QRCode_Exception
  • Access: public

Parameters:

string   $data   —  the string/data to encode into the barcode
array   $options   —  an array of options for the barcode
array   $append   —  additional data to append (experimental)

[ Top ]

maskSelection   [line 1256]

integer maskSelection( integer $max_modules_1side)

Selects the mask to use
  • Access: protected

Parameters:

integer   $max_modules_1side   —  Max number of modules (single side)

[ Top ]

performECCOperation   [line 860]

array performECCOperation( array $matrix_remain_bit, integer $max_codewords)

Performs the error correction and code generation operations
  • Access: protected

Parameters:

array   $matrix_remain_bit   —  array of remaining bits for data matrix
integer   $max_codewords   —  number of maximum codewords

[ Top ]

readECCData   [line 882]

array readECCData( array $matrix_remain_bit, integer $max_codewords)

Read in correct baseline data from ECC/RS files
  • Access: protected

Parameters:

array   $matrix_remain_bit   —  array of remaining bits for data matrix
integer   $max_codewords   —  number of maximum codewords

[ Top ]

setData   [line 423]

void setData( string $str)

Sets the data to encode
  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

string   $str   —  the data to encode into the barcode

[ Top ]

setErrorCorrect   [line 447]

void setErrorCorrect( char $e)

Sets the error correction level.

One of: L: 7% error level M: 15% error level Q: 25% error level H: 30% error level

  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

char   $e   —  the error level to use

[ Top ]

setImageType   [line 507]

void setImageType( string $t)

Defines the return image type (from 'jpeg', or 'png')

Default is PNG format

  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

string   $t   —  the image type to use

[ Top ]

setModuleSize   [line 465]

void setModuleSize( integer $size)

Sets the default module size Defaults are PNG: 4, JPEG: 8
  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

integer   $size   —  the module size to use

[ Top ]

setOutputType   [line 527]

void setOutputType( string $t)

Sets what to do once the code has been generated ('display' or 'return')

Default is to display the image, complete with headers.

  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

string   $t   —  what to do with the image once it's been created

[ Top ]

setPaddingCharacter   [line 1026]

integer setPaddingCharacter( integer $codewordsCounter)

Sets the padding character to pad out data
  • Access: protected

Parameters:

integer   $codewordsCounter   —  counter for current no. of codewords

[ Top ]

setStructureAppend   [line 543]

void setStructureAppend( [array $data = array()])

Sets the data to append to the code (experimental)
  • Access: protected

Parameters:

array   $data   —  an array of elements (n, m, parity, originaldata)

[ Top ]

setVersion   [line 487]

void setVersion( integer $v)

Sets the version number to use (between 1 and 40)

Version 1 is 21*21 matrix and 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix.

  • Throws: Image_QRCode_Exception
  • Access: protected

Parameters:

integer   $v   —  the version number to use for this barcode

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.