프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$backColor | the background color. For example, 0x55FF00. Defaults to 0xFFFFFF, meaning white color. | ||
$fixedVerifyCode | the fixed verification code. When this property is set, CaptchaAction::getVerifyCode will always return the value of this property. This is mainly used in automated tests where we want to be able to reproduce the same verification code each time we run the tests. If not set, it means the verification code will be randomly generated. | ||
$fontFile | the TrueType font file. This can be either a file path or path alias. | ||
$foreColor | the font color. For example, 0x55FF00. Defaults to 0x2040A0 (blue color). | ||
$height | the height of the generated CAPTCHA image. Defaults to 50. | ||
$imageLibrary | the rendering library to use. Currently supported only 'gd' and 'imagick'. If not set, library will be determined automatically. | ||
$maxLength | the maximum length for randomly generated word. Defaults to 7. | ||
$minLength | the minimum length for randomly generated word. Defaults to 6. | ||
$offset | the offset between characters. Defaults to -2. You can adjust this property in order to decrease or increase the readability of the captcha. | ||
$padding | padding around the text. Defaults to 2. | ||
$testLimit | how many times should the same CAPTCHA be displayed. Defaults to 3. A value less than or equal to 0 means the test is unlimited (available since version 1.1.2). | ||
$transparent | whether to use transparent background. Defaults to false. | ||
$width | the width of the generated CAPTCHA image. Defaults to 120. |
메소드 | 설명 | |
---|---|---|
generateValidationHash ( string $code ) : string | Generates a hash code that can be used for client-side validation. | |
getVerifyCode ( boolean $regenerate = false ) : string | Gets the verification code. | |
init ( ) | Initializes the action. | |
run ( ) | Runs the action. | |
validate ( string $input, boolean $caseSensitive ) : boolean | Validates the input to see if it matches the generated code. |
메소드 | 설명 | |
---|---|---|
generateVerifyCode ( ) : string | Generates a new verification code. | |
getSessionKey ( ) : string | Returns the session variable name used to store verification code. | |
renderImage ( string $code ) : string | Renders the CAPTCHA image. | |
renderImageByGD ( string $code ) : string | Renders the CAPTCHA image based on the code using GD library. | |
renderImageByImagick ( string $code ) : string | Renders the CAPTCHA image based on the code using ImageMagick library. | |
setHttpHeaders ( ) | Sets the HTTP headers needed by image response. |
public generateValidationHash ( string $code ) : string | ||
$code | string | the CAPTCHA code |
리턴 | string | a hash code generated from the CAPTCHA code |
protected generateVerifyCode ( ) : string | ||
리턴 | string | the generated verification code |
protected getSessionKey ( ) : string | ||
리턴 | string | the session variable name |
public getVerifyCode ( boolean $regenerate = false ) : string | ||
$regenerate | boolean | whether the verification code should be regenerated. |
리턴 | string | the verification code. |
protected renderImage ( string $code ) : string | ||
$code | string | the verification code |
리턴 | string | image contents |
protected renderImageByGD ( string $code ) : string | ||
$code | string | the verification code |
리턴 | string | image contents in PNG format. |
protected renderImageByImagick ( string $code ) : string | ||
$code | string | the verification code |
리턴 | string | image contents in PNG format. |
protected setHttpHeaders ( ) |
public $backColor |
public $fixedVerifyCode |
public $fontFile |
public $foreColor |
public $imageLibrary |
public $maxLength |
public $minLength |
public $offset |
public $testLimit |
public $transparent |