PHP Class ValidateCode

Afficher le fichier Open project: zblogcn/zblogphp Class Usage Examples

Protected Properties

Свойство Type Description
$backgroundColor array
$charset
$codelen
$contents resource
$distortion boolean
$fingerprint array
$font 高度
$fontsize 字体
$height 宽度
$ignoreAllEffects boolean Ignore all effects
$interpolation boolean Is the interpolation enabled ?
$maxAngle The maximum angle of char
$maxBehindLines The maximum number of lines to draw behind the image. null - use default algorithm
$maxFrontLines The maximum number of lines to draw in front of the image. null - use default algorithm
$maxOffset The maximum offset of char
$phrase string
$textColor array
$useFingerprint boolean
$width 位数

Méthodes publiques

Méthode Description
GetCode ( ) : string 获取验证码
GetImg ( $n = null ) 对外生成
__construct ( )
build ( $fingerprint = null ) Generate the image
create ( $phrase = null ) Instantiation
directOutput ( $quality = 90 ) Outputs the image
distort ( $image, $width, $height, $bg ) Distorts the image
get ( $quality = 90 ) Gets the image contents
getContents ( ) The image contents
getFingerprint ( ) : array
getGd ( ) Gets the image GD
getPhrase ( ) Gets the captcha phrase
inline ( $quality = 90 ) Gets the HTML inline base64
output ( ) Outputs the image
setBackgroundColor ( $r, $g, $b ) Sets the background color to use
setBackgroundImages ( array $backgroundImages ) Sets the list of background images to use (one image is randomly selected)
setDistortion ( $distortion ) Enables/disable distortion
setIgnoreAllEffects ( boolean $ignoreAllEffects ) : CaptchaBuilder Sets the ignoreAllEffects value
setInterpolation ( $interpolate = true ) : CaptchaBuilder Enable/Disables the interpolation
setMaxAngle ( $maxAngle )
setMaxBehindLines ( $maxBehindLines )
setMaxFrontLines ( $maxFrontLines )
setMaxOffset ( $maxOffset )
setPhrase ( $phrase ) Setting the phrase
setTextColor ( $r, $g, $b ) Sets the text color to use

Méthodes protégées

Méthode Description
createCode ( $n = null ) 生成随机码
drawLine ( $image, $width, $height, $tcol = null ) Draw lines over the image
getCol ( $image, $x, $y, $background ) : integer
getRGB ( $col ) : array
interpolate ( $x, $y, $nw, $ne, $sw, $se ) : integer
postEffect ( $image ) Apply some post effects
rand ( $min, $max ) Returns a random number or the next number in the fingerprint
writePhrase ( $image, $phrase, $font, $width, $height ) Writes the phrase on the image

Method Details

GetCode() public méthode

获取验证码
public GetCode ( ) : string
Résultat string

GetImg() public méthode

对外生成
public GetImg ( $n = null )

__construct() public méthode

public __construct ( )

build() public méthode

Generate the image
public build ( $fingerprint = null )

create() public static méthode

Instantiation
public static create ( $phrase = null )

createCode() protected méthode

生成随机码
protected createCode ( $n = null )

directOutput() public méthode

Outputs the image
public directOutput ( $quality = 90 )

distort() public méthode

Distorts the image
public distort ( $image, $width, $height, $bg )

drawLine() protected méthode

Draw lines over the image
protected drawLine ( $image, $width, $height, $tcol = null )

get() public méthode

Gets the image contents
public get ( $quality = 90 )

getCol() protected méthode

protected getCol ( $image, $x, $y, $background ) : integer
$image
$x
$y
Résultat integer

getContents() public méthode

The image contents
public getContents ( )

getFingerprint() public méthode

public getFingerprint ( ) : array
Résultat array

getGd() public méthode

Gets the image GD
public getGd ( )

getPhrase() public méthode

Gets the captcha phrase
public getPhrase ( )

getRGB() protected méthode

protected getRGB ( $col ) : array
$col
Résultat array

inline() public méthode

Gets the HTML inline base64
public inline ( $quality = 90 )

interpolate() protected méthode

protected interpolate ( $x, $y, $nw, $ne, $sw, $se ) : integer
$x
$y
$nw
$ne
$sw
$se
Résultat integer

output() public méthode

Outputs the image
public output ( )

postEffect() protected méthode

Apply some post effects
protected postEffect ( $image )

rand() protected méthode

Returns a random number or the next number in the fingerprint
protected rand ( $min, $max )

setBackgroundColor() public méthode

Sets the background color to use
public setBackgroundColor ( $r, $g, $b )

setBackgroundImages() public méthode

Sets the list of background images to use (one image is randomly selected)
public setBackgroundImages ( array $backgroundImages )
$backgroundImages array

setDistortion() public méthode

Enables/disable distortion
public setDistortion ( $distortion )

setIgnoreAllEffects() public méthode

Sets the ignoreAllEffects value
public setIgnoreAllEffects ( boolean $ignoreAllEffects ) : CaptchaBuilder
$ignoreAllEffects boolean
Résultat CaptchaBuilder

setInterpolation() public méthode

Enable/Disables the interpolation
public setInterpolation ( $interpolate = true ) : CaptchaBuilder
$interpolate bool True to enable, false to disable
Résultat CaptchaBuilder

setMaxAngle() public méthode

public setMaxAngle ( $maxAngle )

setMaxBehindLines() public méthode

public setMaxBehindLines ( $maxBehindLines )

setMaxFrontLines() public méthode

public setMaxFrontLines ( $maxFrontLines )

setMaxOffset() public méthode

public setMaxOffset ( $maxOffset )

setPhrase() public méthode

Setting the phrase
public setPhrase ( $phrase )

setTextColor() public méthode

Sets the text color to use
public setTextColor ( $r, $g, $b )

writePhrase() protected méthode

Writes the phrase on the image
protected writePhrase ( $image, $phrase, $font, $width, $height )

Property Details

$backgroundColor protected_oe property

protected array $backgroundColor
Résultat array

$charset protected_oe property

protected $charset

$codelen protected_oe property

protected $codelen

$contents protected_oe property

protected resource $contents
Résultat resource

$distortion protected_oe property

protected bool $distortion
Résultat boolean

$fingerprint protected_oe property

protected array $fingerprint
Résultat array

$font protected_oe property

高度
protected $font

$fontsize protected_oe property

字体
protected $fontsize

$height protected_oe property

宽度
protected $height

$ignoreAllEffects protected_oe property

Ignore all effects
protected bool $ignoreAllEffects
Résultat boolean

$interpolation protected_oe property

Is the interpolation enabled ?
protected bool $interpolation
Résultat boolean

$maxAngle protected_oe property

The maximum angle of char
protected $maxAngle

$maxBehindLines protected_oe property

The maximum number of lines to draw behind the image. null - use default algorithm
protected $maxBehindLines

$maxFrontLines protected_oe property

The maximum number of lines to draw in front of the image. null - use default algorithm
protected $maxFrontLines

$maxOffset protected_oe property

The maximum offset of char
protected $maxOffset

$phrase protected_oe property

protected string $phrase
Résultat string

$textColor protected_oe property

protected array $textColor
Résultat array

$useFingerprint protected_oe property

protected bool $useFingerprint
Résultat boolean

$width protected_oe property

位数
protected $width