本文整理汇总了PHP中Captcha::image方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::image方法的具体用法?PHP Captcha::image怎么用?PHP Captcha::image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Captcha
的用法示例。
在下文中一共展示了Captcha::image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Captcha
function action_captcha()
{
include_once "lib/Captcha.php";
$captcha = new Captcha();
$captcha->image($captcha->captchaword());
}
示例2: image_create
/**
* Creates an image resource with the dimensions specified in config.
* If a background image is supplied, the image dimensions are used.
*
* @throws Kohana_Exception if no GD2 support
* @param string path to the background image file
* @return void
*/
protected function image_create($background = null)
{
// Check for GD2 support
if (!function_exists('imagegd2')) {
Core::show_500(__('captcha.requires_GD2'));
}
// Create a new image (black)
Captcha::$image = imagecreatetruecolor(Captcha::$config['width'], Captcha::$config['height']);
// Use a background image
if (!empty($background)) {
/*
// Create the image using the right function for the filetype
$function = 'imagecreatefrom' . Captcha::image_type($filename);
Captcha::$background_image = $function($background);
// Resize the image if needed
if ( imagesx(Captcha::background_image) !== Captcha::$config['width'] or imagesy(Captcha::background_image) !== Captcha::$config['height'] )
{
imagecopyresampled(Captcha::image, Captcha::background_image, 0, 0, 0, 0, Captcha::$config['width'], Captcha::$config['height'], imagesx(Captcha::background_image), imagesy(Captcha::background_image));
}
// Free up resources
imagedestroy(Captcha::background_image);
*/
}
}