本文整理汇总了PHP中Captcha::CreateImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::CreateImage方法的具体用法?PHP Captcha::CreateImage怎么用?PHP Captcha::CreateImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Captcha
的用法示例。
在下文中一共展示了Captcha::CreateImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image
/**
* @param $session
*/
function image($session)
{
App::import('Vendor', 'Captcha', array('file' => 'captcha' . DS . 'captcha.php'));
$captcha = new Captcha();
$captcha->session_var = $this->sessionName . $session;
$captcha->CreateImage();
}
示例2: getCaptcha
/**
* @brief 生成验证码
* @return image图像
*/
public function getCaptcha()
{
//清空布局
$this->layout = '';
//配置参数
$width = IReq::get('w') ? IReq::get('w') : 130;
$height = IReq::get('h') ? IReq::get('h') : 45;
$wordLength = IReq::get('l') ? IReq::get('l') : 5;
$fontSize = IReq::get('s') ? IReq::get('s') : 25;
//创建验证码
$ValidateObj = new Captcha();
$ValidateObj->width = $width;
$ValidateObj->height = $height;
$ValidateObj->maxWordLength = $wordLength;
$ValidateObj->minWordLength = $wordLength;
$ValidateObj->fontSize = $fontSize;
$ValidateObj->CreateImage($text);
//设置验证码
ISafe::set('captcha', $text);
}
示例3: function
<?php
$this->app->router->get('captcha/image', ['as' => 'captcha', 'middleware' => ['\\Illuminate\\Cookie\\Middleware\\EncryptCookies', '\\Illuminate\\Session\\Middleware\\StartSession'], function () {
return \Captcha::CreateImage();
}]);
示例4: captcha
/**
* 验证码
*/
function captcha()
{
// 图片大小全局配置,扩展请在此添加
$conf = array('s' => array('width' => 250, 'height' => 40, 'minSize' => 20, 'maxSize' => 22, 'wave' => true), 'm' => array('width' => 130, 'height' => 40, 'minSize' => 14, 'maxSize' => 16, 'wave' => false), 'n' => array('width' => 100, 'height' => 30, 'minSize' => 12, 'maxSize' => 12, 'wave' => false));
$ini = $conf['s'];
import('@.Rover.Captcha');
$captcha = new Captcha();
$captcha->resourcesPath = 'wp-include/ThirdParty/Captcha';
$captcha->width = $ini['width'];
$captcha->height = $ini['height'];
$captcha->fonts = array('ERASDEMI' => array('spacing' => 1, 'minSize' => $ini['minSize'], 'maxSize' => $ini['maxSize'], 'font' => 'ERASDEMI.ttf'), 'CourierNewBold' => array('spacing' => -1, 'minSize' => $ini['minSize'], 'maxSize' => $ini['maxSize'], 'font' => 'CourierNewBold.ttf'));
$captcha->session_var = 'verification_code';
if ($ini['wave'] == true) {
$captcha->Yperiod = 28;
$captcha->Yamplitude = 8;
$captcha->Xperiod = 18;
$captcha->Xamplitude = 4;
} else {
$captcha->Yperiod = 0;
$captcha->Yamplitude = 0;
$captcha->Xperiod = 0;
$captcha->Xamplitude = 0;
$captcha->im_x = 20;
}
$captcha->lineWidth = 1;
$captcha->im = imagecreatefromjpeg($captcha->resourcesPath . '/bg_' . mt_rand(0, 2) . '.jpg');
$captcha->scale = 3;
$captcha->colors = array(array(27, 78, 181), array(19, 121, 100), array(42, 52, 64), array(128, 15, 87), array(214, 36, 7));
// red
$captcha->shadowColor = array(255, 255, 255);
$captcha->CreateImage();
}
示例5: Captcha
/**
* Script para la generaci�n de CAPTCHAS
*
* @author Jose Rodriguez <jose.rodriguez@exec.cl>
* @license GPLv3
* @link http://code.google.com/p/cool-php-captcha
* @package captcha
* @version 0.3
*
*/
namespace Captcha;
session_start();
$captcha = new Captcha();
// Image generation
$captcha->CreateImage();
/**
* SimpleCaptcha class
*
*/
class Captcha
{
/** Width of the image */
public $width = 200;
/** Height of the image */
public $height = 70;
/** Dictionary word file (empty for random text) */
public $wordsFile = '';
/**
* Path for resource files (fonts, words, etc.)
*
示例6: getCaptcha
function getCaptcha()
{
$width = intval(IReq::get('w')) == 0 ? 130 : IFilter::act(IReq::get('w'));
$height = intval(IReq::get('h')) == 0 ? 45 : IFilter::act(IReq::get('h'));
$wordLength = intval(IReq::get('l')) == 0 ? 5 : IFilter::act(IReq::get('l'));
$fontSize = intval(IReq::get('s')) == 0 ? 25 : IReq::get('s');
$ValidateObj = new Captcha();
$ValidateObj->width = $width;
$ValidateObj->height = $height;
$ValidateObj->maxWordLength = $wordLength;
$ValidateObj->minWordLength = $wordLength;
$ValidateObj->fontSize = $fontSize;
$ValidateObj->CreateImage($text);
exit;
}
示例7: Captcha
<?php
session_start();
include_once 'Captcha.php';
$captcha = new Captcha();
$_SESSION['captcha'] = $captcha->CreateImage();
示例8: Captcha
<?php
session_start();
require_once 'file:///C|/wamp/www/CaptchaCodeManagemant/Captcha.php';
$objCaptcha = new Captcha(60, 20);
$objCaptcha->CreateImage();
$objCaptcha->getImage();
$_SESSION["code"] = $objCaptcha->getCode();
//header('location:../CaptchaCodeManagemant/page.php');
示例9: getCaptcha
/**
* @brief 生成验证码
* @return image图像
*/
public function getCaptcha()
{
//清空布局
$this->layout = '';
//配置参数
$width = intval(IReq::get('w')) == 0 ? 130 : IReq::get('w');
$height = intval(IReq::get('h')) == 0 ? 45 : IReq::get('h');
$wordLength = intval(IReq::get('l')) == 0 ? 5 : IReq::get('l');
$fontSize = intval(IReq::get('s')) == 0 ? 25 : IReq::get('s');
//创建验证码
$ValidateObj = new Captcha();
$ValidateObj->width = $width;
$ValidateObj->height = $height;
$ValidateObj->maxWordLength = $wordLength;
$ValidateObj->minWordLength = $wordLength;
$ValidateObj->fontSize = $fontSize;
$ValidateObj->CreateImage($text);
//设置验证码
ISafe::set('Captcha', $text);
}