Captcha/Image.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Captcha  
Subpackage
Adapter  
Version
$Id$  

\Zend_Captcha_Image

Package: Zend_Captcha\Adapter
Image-based captcha element
Generates image displaying random word
Parent(s)
\Zend_Captcha_Word < \Zend_Captcha_Base < \Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedint $_dotNoiseLevel = 100
Number of noise dots on image Used twice - before and after transform
Default value100Details
Type
int
>VPropertyprotectedint $_expiration = 600
How long to keep generated images
Default value600Details
Type
int
>VPropertyprotectedstring $_font
Image font file
Details
Type
string
>VPropertyprotectedint $_fsize = 24
Font size
Default value24Details
Type
int
>VPropertyprotectedint $_gcFreq = 10
How frequently to execute garbage collection
Default value10Details
Type
int
>VPropertyprotectedint $_height = 50
Image height
Default value50Details
Type
int
>VPropertyprotectedstring $_imgAlt = ""
Image's alt tag content
Default value""Details
Type
string
>VPropertyprotectedstring $_imgDir = "./images/captcha/"
Directory for generated images
Default value"./images/captcha/"Details
Type
string
>VPropertyprotectedstring $_imgUrl = "/images/captcha/"
URL for accessing images
Default value"/images/captcha/"Details
Type
string
>VPropertyprotectedint $_lineNoiseLevel = 5
Number of noise lines on image Used twice - before and after transform
Default value5Details
Type
int
>VPropertyprotectedstring $_startImage
Image to use as starting point Default is blank image. If provided, should be PNG image.
Details
Type
string
>VPropertyprotectedstring $_suffix = ".png"
Image suffix (including dot)
Default value".png"Details
Type
string
>VPropertyprotectedint $_width = 200
Image width
Default value200Details
Type
int

Methods

methodprotected_gc() : void

Remove old files from image directory

methodprotected_generateImage(string $id, string $word) : void

Generate image captcha

Override this function if you want different image generator Wave transform from http://www.captcha.ru/captchas/multiwave/
Parameters
NameTypeDescription
$idstring

Captcha ID

$wordstring

Captcha word

methodprotected_randomFreq() : float

Generate random frequency

Returns
TypeDescription
float
methodprotected_randomPhase() : float

Generate random phase

Returns
TypeDescription
float
methodprotected_randomSize() : int

Generate random character size

Returns
TypeDescription
int
methodpublicgenerate() : string

Generate captcha

Returns
TypeDescription
stringcaptcha ID
methodpublicgetDotNoiseLevel() : int

Returns
TypeDescription
int
methodpublicgetExpiration() : int

Get captcha expiration

Returns
TypeDescription
int
methodpublicgetFont() : string

Get font to use when generating captcha

Returns
TypeDescription
string
methodpublicgetFontSize() : int

Get font size

Returns
TypeDescription
int
methodpublicgetGcFreq() : int

Get garbage collection frequency

Returns
TypeDescription
int
methodpublicgetHeight() : int

Get captcha image height

Returns
TypeDescription
int
methodpublicgetImgAlt() : string

Returns
TypeDescription
string
methodpublicgetImgDir() : string

Get captcha image directory

Returns
TypeDescription
string
methodpublicgetImgUrl() : string

Get captcha image base URL

Returns
TypeDescription
string
methodpublicgetLineNoiseLevel() : int

Returns
TypeDescription
int
methodpublicgetStartImage() : string

Returns
TypeDescription
string
methodpublicgetSuffix() : string

Get captcha image file suffix

Returns
TypeDescription
string
methodpublicgetWidth() : int

Get captcha image width

Returns
TypeDescription
int
methodpublicrender(\Zend_View_Interface $view = null, mixed $element = null) : string

Display the captcha

Parameters
NameTypeDescription
$view\Zend_View_Interface
$elementmixed
Returns
TypeDescription
string
methodpublicsetDotNoiseLevel(int $dotNoiseLevel) : void

Parameters
NameTypeDescription
$dotNoiseLevelint
methodpublicsetExpiration(int $expiration) : \Zend_Captcha_Image

Set captcha expiration

Parameters
NameTypeDescription
$expirationint
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetFont(string $font) : \Zend_Captcha_Image

Set captcha font

Parameters
NameTypeDescription
$fontstring
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetFontSize(int $fsize) : \Zend_Captcha_Image

Set captcha font size

Parameters
NameTypeDescription
$fsizeint
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetGcFreq(int $gcFreq) : \Zend_Captcha_Image

Set garbage collection frequency

Parameters
NameTypeDescription
$gcFreqint
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetHeight(int $height) : \Zend_Captcha_Image

Set captcha image height

Parameters
NameTypeDescription
$heightint
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetImgAlt(string $imgAlt) : void

Parameters
NameTypeDescription
$imgAltstring
methodpublicsetImgDir(string $imgDir) : \Zend_Captcha_Image

Set captcha image storage directory

Parameters
NameTypeDescription
$imgDirstring
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetImgUrl(string $imgUrl) : \Zend_Captcha_Image

Set captcha image base URL

Parameters
NameTypeDescription
$imgUrlstring
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetLineNoiseLevel(int $lineNoiseLevel) : void

Parameters
NameTypeDescription
$lineNoiseLevelint
methodpublicsetStartImage(string $startImage) : void

Parameters
NameTypeDescription
$startImagestring
methodpublicsetSuffix(string $suffix) : \Zend_Captcha_Image

Set captch image filename suffix

Parameters
NameTypeDescription
$suffixstring
Returns
TypeDescription
\Zend_Captcha_Image
methodpublicsetWidth(int $width) : \Zend_Captcha_Image

Set captcha image width

Parameters
NameTypeDescription
$widthint
Returns
TypeDescription
\Zend_Captcha_Image
Documentation was generated by phpDocumentor 2.2.0 .