PHP Класс ValidateCode

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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 位数

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Описание методов

GetCode() публичный Метод

获取验证码
public GetCode ( ) : string
Результат string

GetImg() публичный Метод

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

__construct() публичный Метод

public __construct ( )

build() публичный Метод

Generate the image
public build ( $fingerprint = null )

create() публичный статический Метод

Instantiation
public static create ( $phrase = null )

createCode() защищенный Метод

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

directOutput() публичный Метод

Outputs the image
public directOutput ( $quality = 90 )

distort() публичный Метод

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

drawLine() защищенный Метод

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

get() публичный Метод

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

getCol() защищенный Метод

protected getCol ( $image, $x, $y, $background ) : integer
$image
$x
$y
Результат integer

getContents() публичный Метод

The image contents
public getContents ( )

getFingerprint() публичный Метод

public getFingerprint ( ) : array
Результат array

getGd() публичный Метод

Gets the image GD
public getGd ( )

getPhrase() публичный Метод

Gets the captcha phrase
public getPhrase ( )

getRGB() защищенный Метод

protected getRGB ( $col ) : array
$col
Результат array

inline() публичный Метод

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

interpolate() защищенный Метод

protected interpolate ( $x, $y, $nw, $ne, $sw, $se ) : integer
$x
$y
$nw
$ne
$sw
$se
Результат integer

output() публичный Метод

Outputs the image
public output ( )

postEffect() защищенный Метод

Apply some post effects
protected postEffect ( $image )

rand() защищенный Метод

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

setBackgroundColor() публичный Метод

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

setBackgroundImages() публичный Метод

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

setDistortion() публичный Метод

Enables/disable distortion
public setDistortion ( $distortion )

setIgnoreAllEffects() публичный Метод

Sets the ignoreAllEffects value
public setIgnoreAllEffects ( boolean $ignoreAllEffects ) : CaptchaBuilder
$ignoreAllEffects boolean
Результат CaptchaBuilder

setInterpolation() публичный Метод

Enable/Disables the interpolation
public setInterpolation ( $interpolate = true ) : CaptchaBuilder
$interpolate bool True to enable, false to disable
Результат CaptchaBuilder

setMaxAngle() публичный Метод

public setMaxAngle ( $maxAngle )

setMaxBehindLines() публичный Метод

public setMaxBehindLines ( $maxBehindLines )

setMaxFrontLines() публичный Метод

public setMaxFrontLines ( $maxFrontLines )

setMaxOffset() публичный Метод

public setMaxOffset ( $maxOffset )

setPhrase() публичный Метод

Setting the phrase
public setPhrase ( $phrase )

setTextColor() публичный Метод

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

writePhrase() защищенный Метод

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

Описание свойств

$backgroundColor защищенное свойство

protected array $backgroundColor
Результат array

$charset защищенное свойство

protected $charset

$codelen защищенное свойство

protected $codelen

$contents защищенное свойство

protected resource $contents
Результат resource

$distortion защищенное свойство

protected bool $distortion
Результат boolean

$fingerprint защищенное свойство

protected array $fingerprint
Результат array

$font защищенное свойство

高度
protected $font

$fontsize защищенное свойство

字体
protected $fontsize

$height защищенное свойство

宽度
protected $height

$ignoreAllEffects защищенное свойство

Ignore all effects
protected bool $ignoreAllEffects
Результат boolean

$interpolation защищенное свойство

Is the interpolation enabled ?
protected bool $interpolation
Результат boolean

$maxAngle защищенное свойство

The maximum angle of char
protected $maxAngle

$maxBehindLines защищенное свойство

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

$maxFrontLines защищенное свойство

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

$maxOffset защищенное свойство

The maximum offset of char
protected $maxOffset

$phrase защищенное свойство

protected string $phrase
Результат string

$textColor защищенное свойство

protected array $textColor
Результат array

$useFingerprint защищенное свойство

protected bool $useFingerprint
Результат boolean

$width защищенное свойство

位数
protected $width