本文整理汇总了PHP中Securimage::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Securimage::show方法的具体用法?PHP Securimage::show怎么用?PHP Securimage::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Securimage
的用法示例。
在下文中一共展示了Securimage::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendCaptcha
public static function sendCaptcha()
{
$libPath = INSTALL_PATH . "/server/classes/securimage";
$img = new Securimage();
$img->wordlist_file = $libPath . "/words/words.txt";
$img->gd_font_file = $libPath . "/gdfonts/automatic.gdf";
$img->signature_font = $img->ttf_file = $libPath . "/AHGBold.ttf";
$img->image_height = 80;
$img->image_width = 170;
$img->perturbation = 0.85;
$img->image_bg_color = new Securimage_Color("#f6f6f6");
$img->multi_text_color = array(new Securimage_Color("#3399ff"), new Securimage_Color("#3300cc"), new Securimage_Color("#3333cc"), new Securimage_Color("#6666ff"), new Securimage_Color("#99cccc"));
$img->use_multi_text = true;
$img->text_angle_minimum = -5;
$img->text_angle_maximum = 5;
$img->use_transparent_text = true;
$img->text_transparency_percentage = 30;
// 100 = completely transparent
$img->num_lines = 5;
$img->line_color = new Securimage_Color("#eaeaea");
$img->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
$img->use_wordlist = true;
if (!function_exists('imagettftext')) {
$img->use_gd_font = true;
$img->use_transparent_text = false;
$img->use_multi_text = false;
}
//$img->show($libPath."/backgrounds/bg3.jpg");
$img->show();
}
示例2: securimages_show
public function securimages_show()
{
$img = new Securimage();
// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
//$img->ttf_file = './Quiff.ttf';
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text
//$img->case_sensitive = true; // true to use case sensitve codes - not recommended
//$img->image_height = 90; // height in pixels of the image
//$img->image_width = $img->image_height * M_E; // a good formula for image size based on the height
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
//$img->image_bg_color = new Securimage_Color("#0099CC"); // image background color
//$img->text_color = new Securimage_Color("#EAEAEA"); // captcha text color
//$img->num_lines = 8; // how many lines to draw over the image
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
//$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
// rand(64, 128),
// rand(128, 255)); // random signature color
// see securimage.php for more options that can be set
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
$img->show();
// outputs the image and content headers to the browser
// alternate use:
// $img->show('/path/to/background_image.jpg');
}
示例3: show
function show()
{
$options = array('text_color' => new Securimage_Color('#e80707'), 'captcha_type' => 1, 'noise_level' => 2);
$phpcaptcha = new Securimage($options);
$phpcaptcha->show();
exit;
}
示例4: actionCaptcha
public function actionCaptcha()
{
require_once dirname(__FILE__) . '/../widget/secureimage/assets/securimage.php';
$img = new \Securimage();
// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
//$img->ttf_file = dirname(__FILE__) . '/../widget/secureimage/assets/AHGBold.ttf';
//$img->captcha_type = \Securimage::SI_CAPTCHA_WORDS; // show a simple math problem instead of text
//$img->case_sensitive = true; // true to use case sensitve codes - not recommended
//$img->image_height = 90; // height in pixels of the image
//$img->image_width = $img->image_height * M_E *1.5; // a good formula for image size based on the height
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
$img->image_bg_color = new \Securimage_Color("#f1f3f4");
// image background color
//$img->text_color = new \Securimage_Color("#000"); // captcha text color
//$img->num_lines = 8; // how many lines to draw over the image
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
//$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
// rand(64, 128),
// rand(128, 255)); // random signature color
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
$img->show();
}
示例5: captcha
/**
* 画像作成。
*/
public function captcha()
{
App::import('Vendor', 'Securimage', array('file' => 'securimage/securimage.php'));
$securimage = new Securimage();
$securimage->ttf_file = ROOT . '/vendors/securimage/AHGBold.ttf';
$securimage->show();
}
示例6: show
public static function show($captcha_name, $width = 300, $height = 100)
{
$options = array('send_headers' => FALSE, 'no_exit' => TRUE);
$img = new Securimage($options);
//Change some settings
$img->namespace = $captcha_name;
$img->image_width = $width;
$img->image_height = $height;
$img->perturbation = 0.85;
$img->image_bg_color = new Securimage_Color("#f6f6f6");
$img->use_transparent_text = true;
$img->text_transparency_percentage = 10;
// 100 = completely transparent
$img->num_lines = 7;
$img->line_color = new Securimage_Color("#eaeaea");
$img->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
ob_start();
// start the output buffer
$img->show(BASEPATH . '../application/third_party/securimage/backgrounds/bg6.jpg');
// alternate use: $img->show('/path/to/background_image.jpg');
$imgBinary = ob_get_contents();
// get contents of the buffer
ob_end_clean();
// turn off buffering and clear the buffer
header('Content-Type: image/png');
header('Content-Length: ' . strlen($imgBinary));
echo $imgBinary;
}
示例7: captcha
/**
* Method to display the captcha to validate the form
*
* @access public
*/
function captcha()
{
include "components/com_visforms/captcha/securimage.php";
$img = new Securimage();
$img->namespace = 'form' . JFactory::getApplication()->input->getInt('id', 0);
$img->ttf_file = "components/com_visforms/captcha/elephant.ttf";
$img->show();
}
示例8: securimage
public function securimage()
{
$this->load->config('csecurimage');
$active = $this->config->item('si_active');
$allsettings = array_merge($this->config->item($active), $this->config->item('si_general'));
$this->load->library('securimage/securimage');
$img = new Securimage($allsettings);
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC;
$img->show(APPPATH . 'libraries/securimage/backgrounds/bg6.png');
}
示例9: generate
public function generate()
{
$config = configHelper::getConfig()['securimageConfig'];
$si = new \Securimage($config);
//securimage write the image data to output buffer, we should get it and clean output buffer and encode image data to a base64 string.
$si->show();
$imageData = ob_get_contents();
ob_get_clean();
$imageStr = base64_encode($imageData);
$imageCode = $si->getCode(false, true);
return ['data' => $imageStr, 'code' => $imageCode];
}
示例10: getCaptcha
public function getCaptcha(Request $request)
{
$config = Config::get('securimage');
$captcha = new \Securimage();
$captcha->code_length = $config['length'];
$captcha->image_width = $config['width'];
$captcha->image_height = $config['height'];
$captcha->perturbation = $config['perturbation'];
$captcha->case_sensitive = $config['case_sensitive'];
$captcha->num_lines = $config['num_lines'];
$captcha->charset = $config['charset'];
$captcha->show();
}
示例11: generate
/**
* @inheritdoc
*/
protected function generate($generate = false)
{
if (!empty($this->data) && $generate === false) {
return $this->data;
}
switch ($this->provider->image_type) {
case Securimage::SI_IMAGE_JPEG:
$this->data['mimeType'] = 'image/jpeg';
break;
case Securimage::SI_IMAGE_GIF:
$this->data['mimeType'] = 'image/gif';
break;
default:
$this->data['mimeType'] = 'image/png';
break;
}
ob_start();
$this->provider->show();
$this->data['image'] = ob_get_clean();
$this->code = $this->provider->getCode([], true);
return $this->data;
}
示例12: Securimage
/**
* 生成验证码2
* @param type $sessionName
* @param type $width
* @param type $height
*/
static function validatePic2($sessionName = "defaultSess", $width = 0, $height = 0)
{
require Yii::app()->basePath . '/components/SecurImage.php';
$validateImage = new Securimage();
$validateImage->use_gd_font = true;
$validateImage->gd_font_file = Yii::app()->basePath . "/components/font/crass.gdf";
$validateImage->draw_lines = false;
$validateImage->arc_linethrough = false;
$validateImage->sess_name = $sessionName;
if ($width != 0) {
$validateImage->image_width = $width;
}
if ($height != 0) {
$validateImage->image_height = $height;
}
$code = $validateImage->createCode();
Yii::app()->session[$sessionName] = strtolower($code);
$validateImage->show();
}
示例13:
//$img->image_height = 90; // height in pixels of the image
//$img->image_width = $img->image_height * M_E; // a good formula for image size based on the height
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
//$img->image_bg_color = new Securimage_Color("#0099CC"); // image background color
//$img->text_color = new Securimage_Color("#EAEAEA"); // captcha text color
//$img->num_lines = 8; // how many lines to draw over the image
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
//$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
// rand(64, 128),
// rand(128, 255)); // random signature color
// $img->ttf_file = './Aller_Bd.ttf';
$img->image_height = 30;
$img->image_width = 81;
$img->image_bg_color = new Securimage_Color(0, 0, 0);
// image background color
$img->perturbation = 0;
$img->text_color = new Securimage_Color(255, 255, 255);
// captcha text color
$img->num_lines = 0;
// how many lines to draw over the image
$img->charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// see securimage.php for more options that can be set
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
$img->show();
// outputs the image and content headers to the browser
// alternate use:
// $img->show('/path/to/background_image.jpg');
示例14: securimage
function securimage()
{
$this->load->library('securimage/securimage');
$img = new Securimage();
$img->show();
}
示例15: Securimage
<?php
require_once 'helpers/Captcha.class.php';
$image = new Securimage();
$image->image_width = 250;
$image->image_height = 80;
$image->perturbation = 0.85;
$image->image_bg_color = new Securimage_Color("#999");
$image->use_transparent_text = true;
$image->num_lines = 3;
$image->line_color = new Securimage_Color("#ccc");
$image->show('images/captcha/bg1.jpg');