QRImage
extends QROutputAbstract
in package
Converts the matrix into GD images, raw or base64 output (requires ext-gd)
Tags
Table of Contents
- TRANSPARENCY_TYPES = [chillerlanQRCodeQRCode::OUTPUT_IMAGE_PNG, chillerlanQRCodeQRCode::OUTPUT_IMAGE_GIF]
- GD image types that support transparency
- $defaultMode : string
- the default output mode of the current output module
- $image : resource|GdImage
- The GD image resource
- $length : int
- the side length of the QR image (modules * scale)
- $matrix : QRMatrix
- the (filled) data matrix object
- $moduleCount : int
- the current size of the QR matrix
- $moduleValues : array<string|int, mixed>
- an (optional) array of color values for the several QR matrix parts
- $options : SettingsContainerInterface
- $outputMode : string
- the current output mode
- $scale : int
- the current scaling for a QR pixel
- __construct() : mixed
- QROutputAbstract constructor.
- dump() : string|resource|GdImage
- generates the output, optionally dumps it to a file, and returns it
- base64encode() : string
- Returns a base64 data URI for the given string and mime type
- dumpImage() : string
- Creates the final image by calling the desired GD output function
- gif() : void
- Jiff - like... JitHub!
- jpg() : void
- JPG output
- png() : void
- PNG output
- saveToFile() : bool
- saves the qr data to a file
- setModuleValues() : void
- Sets the initial module values (clean-up & defaults)
- setPixel() : void
- Creates a single QR pixel with the given settings
Constants
TRANSPARENCY_TYPES
GD image types that support transparency
protected
array<string|int, string>
TRANSPARENCY_TYPES
= [chillerlanQRCodeQRCode::OUTPUT_IMAGE_PNG, chillerlanQRCodeQRCode::OUTPUT_IMAGE_GIF]
Properties
$defaultMode
the default output mode of the current output module
protected
string
$defaultMode
= chillerlanQRCodeQRCode::OUTPUT_IMAGE_PNG
$image
The GD image resource
protected
resource|GdImage
$image
Tags
$length
the side length of the QR image (modules * scale)
protected
int
$length
$matrix
the (filled) data matrix object
protected
QRMatrix
$matrix
$moduleCount
the current size of the QR matrix
protected
int
$moduleCount
Tags
$moduleValues
an (optional) array of color values for the several QR matrix parts
protected
array<string|int, mixed>
$moduleValues
$options
protected
SettingsContainerInterface
$options
$outputMode
the current output mode
protected
string
$outputMode
Tags
$scale
the current scaling for a QR pixel
protected
int
$scale
Tags
Methods
__construct()
QROutputAbstract constructor.
public
__construct(SettingsContainerInterface $options, QRMatrix $matrix) : mixed
Parameters
- $options : SettingsContainerInterface
- $matrix : QRMatrix
Tags
Return values
mixed —dump()
generates the output, optionally dumps it to a file, and returns it
public
dump([string $file = null ]) : string|resource|GdImage
Parameters
- $file : string = null
Tags
Return values
string|resource|GdImage —base64encode()
Returns a base64 data URI for the given string and mime type
protected
base64encode(string $data, string $mime) : string
Parameters
- $data : string
- $mime : string
Return values
string —dumpImage()
Creates the final image by calling the desired GD output function
protected
dumpImage() : string
Tags
Return values
string —gif()
Jiff - like... JitHub!
protected
gif() : void
Return values
void —jpg()
JPG output
protected
jpg() : void
Return values
void —png()
PNG output
protected
png() : void
Return values
void —saveToFile()
saves the qr data to a file
protected
saveToFile(string $data, string $file) : bool
Parameters
- $data : string
- $file : string
Tags
Return values
bool —setModuleValues()
Sets the initial module values (clean-up & defaults)
protected
setModuleValues() : void
Tags
Return values
void —setPixel()
Creates a single QR pixel with the given settings
protected
setPixel(int $x, int $y, array<string|int, mixed> $rgb) : void
Parameters
- $x : int
- $y : int
- $rgb : array<string|int, mixed>