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
$VALUES
hash values
private
array<string|int, mixed>
$VALUES
Tags
$VALUES_INDEX
index of current value
private
int
$VALUES_INDEX
Tags
$width
image width
private
int
$width
Tags
Methods
__construct()
constructor
public
__construct() : mixed
Tags
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
Return values
string —PNG data. Or empty string if GD is not available.
degrade()
Gradient function
private
degrade(resource $img, string $direction, array<string|int, mixed> $color1, array<string|int, mixed> $color2) : resource
taken from:
Parameters
- $img : resource
- $direction : string
- $color1 : array<string|int, mixed>
- $color2 : array<string|int, mixed>
Tags
Return values
resourcedrawshape()
Draw a shape
private
drawshape(resource $image, int $action, int $color) : mixed
Parameters
- $image : resource
- $action : int
- $color : int
Tags
getInt()
Returns a single integer from the $VALUES array (0...255)
private
getInt() : int
Tags
Return values
intgetX()
Returns a single integer from the array (roughly mapped to image width)
private
getX() : int
Tags
Return values
intgetY()
Returns a single integer from the array (roughly mapped to image height)
private
getY() : int