PHP Class SlightPHP\SimpleCaptcha

Show file Open project: hetao29/slightphp

Public Properties

Property Type Description
$Xamplitude
$Xperiod
$Yamplitude
$Yperiod Wave configuracion in X and Y axes
$backgroundColor Background color in RGB-array
$blur Better image results with scale=3
$colors Foreground colors in RGB-array
$debug Debug?
$fonts - font: TTF file - spacing: relative pixel space between character - minSize: min font size - maxSize: max font size
$height Height of the image
$im GD image
$imageFormat Image format: jpeg or png
$maxRotation letter rotation clockwise
$maxWordLength Used for dictionary words indicating the word-length for font-size modification purposes
$minWordLength Min word length (for non-dictionary random text generation)
$scale Internal image size factor (for better image quality) 1: low, 2: medium, 3: high
$session_var Sessionname to store the original text
$shadowColor Shadow color in RGB-array or false
$transprent
$width Width of the image
$wordsFile Dictionary word file (empty for randnom text)

Public Methods

Method Description
CreateImage ( )
GetDictionaryCaptchaText ( boolean $extended = false ) : string Random dictionary word generation
__construct ( $config = [] )

Protected Methods

Method Description
Cleanup ( ) Cleanup
GetCaptchaText ( ) : string Text generation
GetRandomCaptchaText ( $length = null ) : string Random text generation
ImageAllocate ( ) Creates the image resources
ReduceImage ( ) Reduce the image to the final size
WaveImage ( ) Wave filter
WriteImage ( ) File generation
WriteText ( $text, $fontcfg = [] ) Text insertion

Method Details

Cleanup() protected method

Cleanup
protected Cleanup ( )

CreateImage() public method

public CreateImage ( )

GetCaptchaText() protected method

Text generation
protected GetCaptchaText ( ) : string
return string Text

GetDictionaryCaptchaText() public method

Random dictionary word generation
public GetDictionaryCaptchaText ( boolean $extended = false ) : string
$extended boolean Add extended "fake" words
return string Word

GetRandomCaptchaText() protected method

Random text generation
protected GetRandomCaptchaText ( $length = null ) : string
return string Text

ImageAllocate() protected method

Creates the image resources
protected ImageAllocate ( )

ReduceImage() protected method

Reduce the image to the final size
protected ReduceImage ( )

WaveImage() protected method

Wave filter
protected WaveImage ( )

WriteImage() protected method

File generation
protected WriteImage ( )

WriteText() protected method

Text insertion
protected WriteText ( $text, $fontcfg = [] )

__construct() public method

public __construct ( $config = [] )

Property Details

$Xamplitude public property

public $Xamplitude

$Xperiod public property

public $Xperiod

$Yamplitude public property

public $Yamplitude

$Yperiod public property

Wave configuracion in X and Y axes
public $Yperiod

$backgroundColor public property

Background color in RGB-array
public $backgroundColor

$blur public property

Better image results with scale=3
public $blur

$colors public property

Foreground colors in RGB-array
public $colors

$debug public property

Debug?
public $debug

$fonts public property

- font: TTF file - spacing: relative pixel space between character - minSize: min font size - maxSize: max font size
public $fonts

$height public property

Height of the image
public $height

$im public property

GD image
public $im

$imageFormat public property

Image format: jpeg or png
public $imageFormat

$maxRotation public property

letter rotation clockwise
public $maxRotation

$maxWordLength public property

Used for dictionary words indicating the word-length for font-size modification purposes
public $maxWordLength

$minWordLength public property

Min word length (for non-dictionary random text generation)
public $minWordLength

$scale public property

Internal image size factor (for better image quality) 1: low, 2: medium, 3: high
public $scale

$session_var public property

Sessionname to store the original text
public $session_var

$shadowColor public property

Shadow color in RGB-array or false
public $shadowColor

$transprent public property

public $transprent

$width public property

Width of the image
public $width

$wordsFile public property

Dictionary word file (empty for randnom text)
public $wordsFile