\Grafika\Gd\HelperGifHelper

Summary

Methods
Properties
Constants
open()
load()
isAnimated()
encode()
decode()
decodeToBlocks()
expandBlocks()
splitFrames()
resize()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_asciiToHex()
_hexToAscii()
_hexToBin()
_fixSize()
_switchEndian()
No private properties found
N/A

Methods

load()

load(string  $bin) : \Grafika\Gd\Helper\GifByteStream

Parameters

string $bin

Raw binary data from imagegif or file_get_contents

Returns

\Grafika\Gd\Helper\GifByteStream

encode()

encode(array  $data) : string

Encode data into GIF hex string.

Parameters

array $data

The array returned by decode.

Returns

string —

Hex string of GIF

decode()

decode(\Grafika\Gd\Helper\GifByteStream  $bytes) : array

Decode GIF into array of data for easy use in PHP userland.

Parameters

\Grafika\Gd\Helper\GifByteStream $bytes

Decode byte stream into array of GIF blocks.

Throws

\Exception

Returns

array —

Array containing GIF data

decodeToBlocks()

decodeToBlocks(\Grafika\Gd\Helper\GifByteStream  $bytes) : array

Decompose GIF into its block components. The GIF blocks are in the order that they appear in the byte stream.

Parameters

\Grafika\Gd\Helper\GifByteStream $bytes

Throws

\Exception

Returns

array

expandBlocks()

expandBlocks(array  $blocks) : array

Expand GIF blocks into useful info.

Parameters

array $blocks

Accepts the array returned by decodeToBlocks

Returns

array

splitFrames()

splitFrames(array  $blocks) : array

Parameters

array $blocks

The array returned by decode.

Returns

array —

Array of images each containing 1 of each frames of the original image.

resize()

resize(  $blocks,   $newW,   $newH) : array

Parameters

$blocks
$newW
$newH

Returns

array —

$blocks

_asciiToHex()

_asciiToHex(  $asciiString) : string

Parameters

$asciiString

Returns

string

_hexToAscii()

_hexToAscii(  $hexString) : string

Parameters

$hexString

Returns

string

_hexToBin()

_hexToBin(  $hexString) : string

Parameters

$hexString

Returns

string

_fixSize()

_fixSize(  $string,   $size, string  $char = '0') : string

Parameters

$string
$size
string $char

Returns

string

_switchEndian()

_switchEndian(  $hexString) : string

Parameters

$hexString

Returns

string