FfPngHelper
public class FfPngHelper
Method Summary | |
---|---|
array | genPngChunk(int len, string chunkType, mixed chunkData, array PNG) Generates a PNG chunk. |
array | genVerificationImage(int code) Generates a scrambled PNG image of the supplied code. |
array | generatePng(array gzImage, int width, int height) Returns the binary data of an 8 bit grayscale PNG. |
array | getIdat(string filename) Returns the IDAT area of the PNG image at filename. |
array | scrambleScanLine(array line) Returns a scrambled scanline by randomly changing the color of random pixels. |
public array genPngChunk(int len, string chunkType, mixed chunkData, array PNG)
Generates a PNG chunk.
public array genVerificationImage(int code)
Generates a scrambled PNG image of the supplied code.
Scramble Steps:
1. Generates a single large image comprised of smaller images.
2. Digits are randomly placed throughout the larger image.
3. Noise is generated to deter image recognition.
Possible Enhancements: Add strikethrough lines, color, letters; rotate digits.
public array generatePng(array gzImage, int width, int height)
Returns the binary data of an 8 bit grayscale PNG. The spec can be found at PNG Spec
public array getIdat(string filename)
Returns the IDAT area of the PNG image at filename. The FfPngHelper uses this method to combine several images in creating the verification image.
public array scrambleScanLine(array line)
Returns a scrambled scanline by randomly changing the color of random pixels.
FfPngHelper provides helper functions for dynamically creating PNG images that used by the ImageVerificationField. PNG has become the the web image of choice and is supported by all modern web browsers. The spec can be found at PNG Spec