Documentation

Vizhash16x16
in package

Vizhash16x16

Example: $vz = new Vizhash16x16(); $data = $vz->generate(sha512('hello')); header('Content-type: image/png'); echo $data; exit;

Table of Contents

Properties

$height  : int
image height
$VALUES  : array<string|int, mixed>
hash values
$VALUES_INDEX  : int
index of current value
$width  : int
image width

Methods

__construct()  : mixed
constructor
generate()  : string
Generate a 16x16 png corresponding to $text.
degrade()  : resource
Gradient function
drawshape()  : mixed
Draw a shape
getInt()  : int
Returns a single integer from the $VALUES array (0...255)
getX()  : int
Returns a single integer from the array (roughly mapped to image width)
getY()  : int
Returns a single integer from the array (roughly mapped to image height)

Properties

$height

image height

private int $height
Tags
access

private

$VALUES

hash values

private array<string|int, mixed> $VALUES
Tags
access

private

$VALUES_INDEX

index of current value

private int $VALUES_INDEX
Tags
access

private

$width

image width

private int $width
Tags
access

private

Methods

__construct()

constructor

public __construct() : mixed
Tags
access

public

generate()

Generate a 16x16 png corresponding to $text.

public generate(string $text) : string

The given text should to be 128 to 150 characters long

Parameters
$text : string
Tags
access

public

Return values
string

PNG data. Or empty string if GD is not available.

drawshape()

Draw a shape

private drawshape(resource $image, int $action, int $color) : mixed
Parameters
$image : resource
$action : int
$color : int
Tags
access

private

getInt()

Returns a single integer from the $VALUES array (0...255)

private getInt() : int
Tags
access

private

Return values
int

getX()

Returns a single integer from the array (roughly mapped to image width)

private getX() : int
Tags
access

private

Return values
int

getY()

Returns a single integer from the array (roughly mapped to image height)

private getY() : int
Tags
access

private

Return values
int

        
On this page

Search results