本文整理汇总了PHP中captcha::CreateImage方法的典型用法代码示例。如果您正苦于以下问题:PHP captcha::CreateImage方法的具体用法?PHP captcha::CreateImage怎么用?PHP captcha::CreateImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类captcha
的用法示例。
在下文中一共展示了captcha::CreateImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateImage
<?php
$captcha = new captcha();
$captcha->CreateImage();
class captcha
{
public $width = 150;
public $height = 50;
public $font_path = 'fonts/';
public $minWordLength = 5;
public $maxWordLength = 5;
public $backgroundColor = array(255, 255, 255);
public $colors = array(array(27, 78, 181), array(22, 163, 35), array(214, 36, 7));
public $shadowColor = null;
public $fonts = array('Antykwa' => array('spacing' => -3, 'minSize' => 27, 'maxSize' => 30, 'font' => 'AntykwaBold.ttf'), 'Candice' => array('spacing' => -1.5, 'minSize' => 28, 'maxSize' => 31, 'font' => 'Candice.ttf'), 'DingDong' => array('spacing' => -2, 'minSize' => 24, 'maxSize' => 30, 'font' => 'Ding-DongDaddyO.ttf'), 'Duality' => array('spacing' => -2, 'minSize' => 30, 'maxSize' => 38, 'font' => 'Duality.ttf'), 'Heineken' => array('spacing' => -2, 'minSize' => 24, 'maxSize' => 34, 'font' => 'Heineken.ttf'), 'Jura' => array('spacing' => -2, 'minSize' => 28, 'maxSize' => 32, 'font' => 'Jura.ttf'), 'StayPuft' => array('spacing' => -1.5, 'minSize' => 28, 'maxSize' => 32, 'font' => 'StayPuft.ttf'), 'Times' => array('spacing' => -2, 'minSize' => 28, 'maxSize' => 34, 'font' => 'TimesNewRomanBold.ttf'), 'VeraSans' => array('spacing' => -1, 'minSize' => 20, 'maxSize' => 28, 'font' => 'VeraSansBold.ttf'));
public $Yperiod = 12;
public $Yamplitude = 14;
public $Xperiod = 11;
public $Xamplitude = 5;
public $maxRotation = 8;
public $scale = 2;
public $blur = false;
public $imageFormat = 'png';
public $im;
public function CreateImage()
{
$ini = microtime(true);
$this->ImageAllocate();
$text = $this->GetCaptchaText();
$fontcfg = $this->fonts[array_rand($this->fonts)];
$this->WriteText($text, $fontcfg);
示例2: captcha
/**
* Cria o captcha caso o número de tentativas de login falhos seja maior ou igual a 5
*/
public function captcha()
{
$captcha = new captcha();
if ($_SESSION['ntentativaLogin'] >= 5) {
$captcha->CreateImage();
} else {
echo false;
}
}