PHP Class Grafika\Gd\Helper\GifHelper

Datei anzeigen Open project: kosinix/grafika Class Usage Examples

Public Methods

Method Description
decode ( GifByteStream $bytes ) : array Decode GIF into array of data for easy use in PHP userland.
decodeToBlocks ( GifByteStream $bytes ) : array Decompose GIF into its block components. The GIF blocks are in the order that they appear in the byte stream.
encode ( array $data ) : string Encode data into GIF hex string.
expandBlocks ( array $blocks ) : array Expand GIF blocks into useful info.
isAnimated ( GifByteStream $bytes ) : boolean
load ( string $bin ) : GifByteStream
open ( $imageFile ) : GifByteStream
resize ( $blocks, $newW, $newH ) : array
splitFrames ( array $blocks ) : array

Private Methods

Method Description
_asciiToHex ( $asciiString ) : string
_fixSize ( $string, $size, string $char = '0' ) : string
_hexToAscii ( $hexString ) : string
_hexToBin ( $hexString ) : string
_switchEndian ( $hexString ) : string

Method Details

decode() public method

Decode GIF into array of data for easy use in PHP userland.
public decode ( GifByteStream $bytes ) : array
$bytes GifByteStream Decode byte stream into array of GIF blocks.
return array Array containing GIF data

decodeToBlocks() public method

Decompose GIF into its block components. The GIF blocks are in the order that they appear in the byte stream.
public decodeToBlocks ( GifByteStream $bytes ) : array
$bytes GifByteStream
return array

encode() public method

Encode data into GIF hex string.
public encode ( array $data ) : string
$data array The array returned by decode.
return string Hex string of GIF

expandBlocks() public method

Expand GIF blocks into useful info.
public expandBlocks ( array $blocks ) : array
$blocks array Accepts the array returned by decodeToBlocks
return array

isAnimated() public method

public isAnimated ( GifByteStream $bytes ) : boolean
$bytes GifByteStream
return boolean

load() public method

public load ( string $bin ) : GifByteStream
$bin string Raw binary data from imagegif or file_get_contents
return GifByteStream

open() public method

public open ( $imageFile ) : GifByteStream
$imageFile
return GifByteStream

resize() public method

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

splitFrames() public method

public splitFrames ( array $blocks ) : array
$blocks array The array returned by decode.
return array Array of images each containing 1 of each frames of the original image.