The Zend_Captcha_Image adapter takes the generated word and
renders it as an image, performing various skewing permutations to make it
difficult to automatically decipher. It
requires the GD extension
compiled with TrueType or Freetype support. Currently, the
Zend_Captcha_Image adapter can only generate
PNG images.
Zend_Captcha_Image extends
Zend_Captcha_Word, and additionally exposes the
following methods:
setExpiration($expiration)andgetExpiration()allow you to specify a maximum lifetime the CAPTCHA image may reside on the filesystem. This is typically a longer than the session lifetime. Garbage collection is run periodically each time the CAPTCHA object is invoked, deleting all images that have expired. Expiration values should be specified in seconds.setGcFreq($gcFreq)andgetGcFreg()allow you to specify how frequently garbage collection should run. Garbage collection will run every 1/$gcFreq calls. The default is 100.setFont($font)andgetFont()allow you to specify the font you will use.$fontshould be a fully qualified path to the font file. This value is required; the CAPTCHA will throw an exception during generation if the font file has not been specified.setFontSize($fsize)andgetFontSize()allow you to specify the font size in pixels for generating the CAPTCHA. The default is 24px.setHeight($height)andgetHeight()allow you to specify the height in pixels of the generated CAPTCHA image. The default is 50px.setWidth($width)andgetWidth()allow you to specify the width in pixels of the generated CAPTCHA image. The default is 200px.setImgDir($imgDir)andgetImgDir()allow you to specify the directory for storing CAPTCHA images. The default is "./images/captcha/", relative to the bootstrap script.setImgUrl($imgUrl)andgetImgUrl()allow you to specify the relative path to a CAPTCHA image to use for HTML markup. The default is "/images/captcha/".setSuffix($suffix)andgetSuffix()allow you to specify the filename suffix for the CAPTCHA image. The default is ".png". Note: changing this value will not change the type of the generated image.setDotNoiseLevel($level)andgetDotNoiseLevel(), along withsetLineNoiseLevel($level)andgetLineNoiseLevel(), allow you to control how much "noise" in the form of random dots and lines the image would contain. Each unit of$levelproduces one random dot or line. The default is 100 dots and 5 lines. The noise is added twice - before and after the image distortion transformation.
All of the above options may be passed to the constructor by simply removing the 'set' method prefix and casting the initial letter to lowercase: "suffix", "height", "imgUrl", etc.




