# Documentation

Menu

## QRGdImageAVIF extends QRGdImage
in package

QRGdImageAVIF.php : 23

GDImage avif output

##### Tags

see
  imageavif()

### Table of Contents

#### Constants

MIME_TYPE = 'image/avif'

#### Properties

$background : int
  The allocated background color
$circleDiameter : float
$circleRadius : float
$connectPaths : bool
$drawCircularModules : bool
$drawLightModules : bool
$eol : string
$excludeFromConnect : array<string|int, int>
$image : GdImage
  The GD image resource
$keepAsSquare : array<string|int, int>
$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|QROptions
  the options instance
$scale : int
$upscaled : bool
  Whether we're running in upscale mode (scale < 20)

#### Methods

__construct() : mixed
  QROutputAbstract constructor.
dump() : string|GdImage
  Generates the output, optionally dumps it to a file, and returns it
moduleValueIsValid() : bool
  implements \chillerlan\QRCode\Output\QROutputInterface::moduleValueIsValid()
checkGD() : void
  Checks whether GD is installed and if the given mode is supported
collectModules() : array<int, mixed>
  collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules
copyVars() : void
  Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.
createImage() : GdImage
  Creates a new GdImage resource and scales it if necessary
drawImage() : void
  Draws the QR image
dumpImage() : string
  Creates the final image by calling the desired GD output function
getDefaultModuleValue() : int
  Returns a default value for either dark or light modules (return value depends on the output class)
getModuleValue() : mixed
  Returns the prepared value for the given $M_TYPE
getModuleValueAt() : mixed
  Returns the prepared module value at the given coordinate [$x, $y] (convenience)
getOutputDimensions() : array<string|int, int>
  Returns a 2 element array with the current output width and height
getQuality() : int
  Returns the image quality value for the current GdImage output child class (defaults to -1 ... 100)
guessMimeType() : string
  Guesses the mime type from the given $imageData
module() : void
  Creates a single QR pixel with the given settings
prepareModuleValue() : int
  Prepares the value for the given input (return value depends on the output class)
renderImage() : void
  Renders the image with the gdimage function for the desired output
saveToFile() : void
  Saves the qr $data to a $file. If $file is null, nothing happens.
setBgColor() : void
  Sets the background color
setMatrixDimensions() : void
  Sets/updates the matrix dimensions
setModuleValues() : void
  Sets the initial module values
setTransparencyColor() : int
  Sets the transparency color, returns the identifier of the new transparent color
toBase64DataURI() : string
  Returns a base64 data URI for the given string and mime type

### Constants

#### MIME_TYPE

QRGdImageAVIF.php : 25
`public final mixed MIME_TYPE = 'image/avif'`

### Properties

#### $background

QRGdImage.php : 47

The allocated background color

`protected int $background`

##### Tags

see
  imagecolorallocate()

#### $circleDiameter

QROutputAbstract.php : 79
`protected float $circleDiameter`

#### $circleRadius

QROutputAbstract.php : 78
`protected float $circleRadius`

##### Tags

see
  QROptions::$circleRadius

#### $connectPaths

QROutputAbstract.php : 70
`protected bool $connectPaths`

##### Tags

see
  QROptions::$connectPaths

#### $drawCircularModules

QROutputAbstract.php : 76
`protected bool $drawCircularModules`

##### Tags

see
  QROptions::$drawCircularModules

#### $drawLightModules

QROutputAbstract.php : 74
`protected bool $drawLightModules`

##### Tags

see
  QROptions::$drawLightModules

#### $eol

QROutputAbstract.php : 72
`protected string $eol`

##### Tags

see
  QROptions::$eol

#### $excludeFromConnect

QROutputAbstract.php : 61
`protected array<string|int, int> $excludeFromConnect`

##### Tags

see
  QROptions::$excludeFromConnect

#### $image

QRGdImage.php : 40

The GD image resource

`protected GdImage $image`

##### Tags

see
  imagecreatetruecolor()

#### $keepAsSquare

QROutputAbstract.php : 66
`protected array<string|int, int> $keepAsSquare`

##### Tags

see
  QROptions::$keepAsSquare

#### $length

QROutputAbstract.php : 38

the side length of the QR image (modules * scale)

`protected int $length`

#### $matrix

QROutputAbstract.php : 50

the (filled) data matrix object

`protected QRMatrix $matrix`

#### $moduleCount

QROutputAbstract.php : 33

the current size of the QR matrix

`protected int $moduleCount`

##### Tags

see
  QRMatrix::getSize()

#### $moduleValues

QROutputAbstract.php : 45

an (optional) array of color values for the several QR matrix parts

`protected array<string|int, mixed> $moduleValues`

##### Tags

phpstan-var

  array<int, mixed>

#### $options

QROutputAbstract.php : 55

the options instance

`protected SettingsContainerInterface|QROptions $options`

#### $scale

QROutputAbstract.php : 68
`protected int $scale`

##### Tags

see
  QROptions::$scale

#### $upscaled

QRGdImage.php : 54

Whether we're running in upscale mode (scale < 20)

`protected bool $upscaled = false`

##### Tags

see
  QROptions::$drawCircularModules

### Methods

#### __construct()

QRGdImage.php : 60

QROutputAbstract constructor.

`public __construct(SettingsContainerInterface|QROptions $options, QRMatrix $matrix) : mixed`

##### Parameters

$options : SettingsContainerInterface|QROptions
$matrix : QRMatrix

##### Tags

throws
  QRCodeOutputException
noinspection

  PhpMissingParentConstructorInspection

#### dump()

QRGdImage.php : 142

Generates the output, optionally dumps it to a file, and returns it

`public dump([string|null $file = null ]) : string|GdImage`

##### Parameters

$file : string|null = null

##### Tags

inheritDoc
throws
  ErrorException|QRCodeOutputException

##### Return values

string|GdImage

#### moduleValueIsValid()

RGBArrayModuleValueTrait.php : 26

implements \chillerlan\QRCode\Output\QROutputInterface::moduleValueIsValid()

`public static moduleValueIsValid(array<string|int, int> $value) : bool`

##### Parameters

$value : array<string|int, int>

##### Return values

bool

#### checkGD()

QRGdImage.php : 80

Checks whether GD is installed and if the given mode is supported

`protected checkGD() : void`

##### Tags

throws
  QRCodeOutputException
codeCoverageIgnore

#### collectModules()

QROutputAbstract.php : 267

collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules

`protected collectModules(Closure $transform) : array<int, mixed>`

The transform callback is called with the following parameters:

$x - current column $y - current row $M_TYPE - field value $M_TYPE_LAYER - (possibly modified) field value that acts as layer id

##### Parameters

$transform : Closure

##### Return values

array<int, mixed>

#### copyVars()

QROutputAbstract.php : 103

Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.

`protected copyVars() : void`

These variables are usually used in the "module" methods and are called up to 31329 times (at version 40).

#### createImage()

QRGdImage.php : 196

Creates a new GdImage resource and scales it if necessary

`protected createImage() : GdImage`

we're scaling the image up in order to draw crisp round circles, otherwise they appear square-y on small scales

##### Tags

see
  https://github.com/chillerlan/php-qrcode/issues/23
throws
  QRCodeOutputException

##### Return values

GdImage

#### drawImage()

QRGdImage.php : 260

Draws the QR image

`protected drawImage() : void`

#### dumpImage()

QRGdImage.php : 314

Creates the final image by calling the desired GD output function

`protected dumpImage() : string`

##### Tags

throws
  QRCodeOutputException

##### Return values

string

#### getDefaultModuleValue()

QRGdImage.php : 133

Returns a default value for either dark or light modules (return value depends on the output class)

`protected getDefaultModuleValue(bool $isDark) : int`

##### Parameters

$isDark : bool

##### Return values

int

#### getModuleValue()

QROutputAbstract.php : 179

Returns the prepared value for the given $M_TYPE

`protected getModuleValue(int $M_TYPE) : mixed`

##### Parameters

$M_TYPE : int

##### Tags

throws
  QRCodeOutputException

  if $moduleValues[$M_TYPE] doesn't exist

#### getModuleValueAt()

QROutputAbstract.php : 191

Returns the prepared module value at the given coordinate [$x, $y] (convenience)

`protected getModuleValueAt(int $x, int $y) : mixed`

##### Parameters

$x : int
$y : int

#### getOutputDimensions()

QROutputAbstract.php : 140

Returns a 2 element array with the current output width and height

`protected getOutputDimensions() : array<string|int, int>`

The type and units of the values depend on the output class. The default value is the current module count * scale.

##### Return values

array<string|int, int>

#### getQuality()

QRGdImage.php : 253

Returns the image quality value for the current GdImage output child class (defaults to -1 ... 100)

`protected getQuality() : int`

##### Return values

int

#### guessMimeType()

QROutputAbstract.php : 216

Guesses the mime type from the given $imageData

`protected guessMimeType(string $imageData) : string`

##### Parameters

$imageData : string

##### Tags

throws
  QRCodeOutputException

##### Return values

string

#### module()

QRGdImage.php : 271

Creates a single QR pixel with the given settings

`protected module(int $x, int $y, int $M_TYPE) : void`

##### Parameters

$x : int
$y : int
$M_TYPE : int

#### prepareModuleValue()

QRGdImage.php : 112

Prepares the value for the given input (return value depends on the output class)

`protected prepareModuleValue(mixed $value) : int`

##### Parameters

$value : mixed

##### Tags

inheritDoc
throws
  QRCodeOutputException

##### Return values

int

#### renderImage()

QRGdImageAVIF.php : 30

Renders the image with the gdimage function for the desired output

`protected renderImage() : void`

##### Tags

throws
  QRCodeOutputException

#### saveToFile()

QROutputAbstract.php : 239

Saves the qr $data to a $file. If $file is null, nothing happens.

`protected saveToFile(string $data[, string|null $file = null ]) : void`

##### Parameters

$data : string
$file : string|null = null

##### Tags

see
  file_put_contents()
see
  QROptions::$cachefile
throws
  QRCodeOutputException

#### setBgColor()

QRGdImage.php : 217

Sets the background color

`protected setBgColor() : void`

#### setMatrixDimensions()

QROutputAbstract.php : 127

Sets/updates the matrix dimensions

`protected setMatrixDimensions() : void`

Call this method if you modify the matrix from within your custom module in case the dimensions have been changed

#### setModuleValues()

QROutputAbstract.php : 147

Sets the initial module values

`protected setModuleValues() : void`

#### setTransparencyColor()

QRGdImage.php : 235

Sets the transparency color, returns the identifier of the new transparent color

`protected setTransparencyColor() : int`

##### Return values

int

#### toBase64DataURI()

QROutputAbstract.php : 201

Returns a base64 data URI for the given string and mime type

`protected toBase64DataURI(string $data[, string|null $mime = null ]) : string`

The mime type can be set via class constant MIME_TYPE in child classes, or given via $mime, otherwise it is guessed from the image $data.

##### Parameters

$data : string
$mime : string|null = null

##### Return values

string

## Search results