Свойство | Тип | Описание | |
---|---|---|---|
$imgHeight | integer | height of the image. | |
$imgWidth | integer | width of the image |
Метод | Описание | |
---|---|---|
__construct ( string $filename = null, boolean $allowOptimisations = true ) | Construct a new EscposImage. | |
getHeight ( ) : integer | ||
getHeightBytes ( ) : integer | ||
getWidth ( ) : integer | ||
getWidthBytes ( ) : integer | ||
isGdLoaded ( ) : boolean | ||
isImagickLoaded ( ) : boolean | ||
load ( string $filename, string $allow_optimisations = true, array $preferred = ['imagick', 'gd', 'native'] ) : |
This is a convinience method to load an image from file, auto-selecting an EscposImage implementation which uses an available library. | |
toColumnFormat ( boolean $doubleDensity = false ) : string[] | Output the image in column format. | |
toRasterFormat ( ) : string | Output the image in raster (row) format. This can result in padding on the right of the image, if its width is not divisible by 8. |
Метод | Описание | |
---|---|---|
getColumnFormatFromFile ( string $filename = null, boolean $highDensityVertical = true ) : string[] | null | ||
getRasterFormatFromFile ( string $filename = null ) : string | null | ||
loadImageData ( string $filename = null ) | Load an image from disk. This default implementation always gives a zero-sized image. | |
setImgData ( string $data ) | Set image data. | |
setImgHeight ( integer $height ) | Set image height. | |
setImgWidth ( integer $width ) | Set image width. |
Метод | Описание | |
---|---|---|
getColumnFormat ( boolean $highDensity ) : string[] | Get column fromat from loaded image pixels, line by line. | |
getColumnFormatLine ( string $lineNo, string $highDensity ) : null | string | Output image in column format. Must be called once for each line of output. | |
getRasterFormat ( ) : string | Get column fromat from loaded image pixels, line by line. |
public __construct ( string $filename = null, boolean $allowOptimisations = true ) | ||
$filename | string | Path to image filename, or null to create an empty image. |
$allowOptimisations | boolean | True (default) to use any library-specific tricks to speed up rendering, false to force the image to be read in pixel-by-pixel, which is easier to unit test and more reproducible between systems, but slower. |
protected getColumnFormatFromFile ( string $filename = null, boolean $highDensityVertical = true ) : string[] | null | ||
$filename | string | Filename to load from |
$highDensityVertical | boolean | True for high density output (24px lines), false for regular density (8px) |
Результат | string[] | null | Column format data as array, or NULL if optimised renderer isn't available in this implementation. |
public getHeightBytes ( ) : integer | ||
Результат | integer | Number of bytes to represent a row of this image |
public getWidthBytes ( ) : integer | ||
Результат | integer | Number of bytes to represent a row of this image |
public static isGdLoaded ( ) : boolean | ||
Результат | boolean | True if GD is loaded, false otherwise |
public static isImagickLoaded ( ) : boolean | ||
Результат | boolean | True if Imagick is loaded, false otherwise |
public static load ( string $filename, string $allow_optimisations = true, array $preferred = ['imagick', 'gd', 'native'] ) : |
||
$filename | string | File to load from |
$allow_optimisations | string | True to allow the fastest rendering shortcuts, false to force the library to read the image into an internal raster format and use PHP to render the image (slower but less fragile). |
$preferred | array | Order to try to load libraries in- escpos-php supports pluggable image libraries. Items can be 'imagick', 'gd', 'native'. |
Результат |
protected loadImageData ( string $filename = null ) | ||
$filename | string | Filename to load from. |
protected setImgData ( string $data ) | ||
$data | string | Image data to use, string of 1's (black) and 0's (white) in row-major order. |
protected setImgHeight ( integer $height ) | ||
$height | integer | height of the image. |
protected setImgWidth ( integer $width ) | ||
$width | integer | width of the image |
public toColumnFormat ( boolean $doubleDensity = false ) : string[] | ||
$doubleDensity | boolean | True for double density (24px) lines, false for single-density (8px) lines. |
Результат | string[] | an array, one item per line of output. All lines will be of equal size. |
public toRasterFormat ( ) : string | ||
Результат | string | The image in raster format. |