PHP Class Zebra\Zpl\Image

Show file Open project: robgridley/zebra Class Usage Examples

Protected Properties

Property Type Description
$encoded string The ASCII hexadecimal encoded image data.
$height integer The image height in pixels.
$image resource The GD image resource.
$width integer The image width in pixels.

Public Methods

Method Description
__construct ( string $data ) Create an instance.
__destruct ( ) Destroy an instance.
height ( ) : integer
toAscii ( ) : string
width ( ) : integer

Protected Methods

Method Description
compress ( string $row, string $lastRow ) : string Compress a row of ASCII hexadecimal data.
compressRepeatingCharacters ( string $row ) : string Compress characters which repeat.
compressTrailingZerosOrOnes ( string $row ) : string Replace trailing zeros or ones with a comma (,) or exclamation (!) respectively.
create ( $data ) : resource Create a new GD image from the supplied string.
encode ( ) : string Encode the image in ASCII hexadecimal by looping over every pixel.

Method Details

__construct() public method

Create an instance.
public __construct ( string $data )
$data string

__destruct() public method

Destroy an instance.
public __destruct ( )

compress() protected method

Compress a row of ASCII hexadecimal data.
protected compress ( string $row, string $lastRow ) : string
$row string
$lastRow string
return string

compressRepeatingCharacters() protected method

Compress characters which repeat.
protected compressRepeatingCharacters ( string $row ) : string
$row string
return string

compressTrailingZerosOrOnes() protected method

Replace trailing zeros or ones with a comma (,) or exclamation (!) respectively.
protected compressTrailingZerosOrOnes ( string $row ) : string
$row string
return string

create() protected method

Create a new GD image from the supplied string.
protected create ( $data ) : resource
$data
return resource

encode() protected method

Encode the image in ASCII hexadecimal by looping over every pixel.
protected encode ( ) : string
return string

height() public method

public height ( ) : integer
return integer

toAscii() public method

public toAscii ( ) : string
return string

width() public method

public width ( ) : integer
return integer

Property Details

$encoded protected property

The ASCII hexadecimal encoded image data.
protected string $encoded
return string

$height protected property

The image height in pixels.
protected int $height
return integer

$image protected property

The GD image resource.
protected resource $image
return resource

$width protected property

The image width in pixels.
protected int $width
return integer