本文整理汇总了PHP中Securimage::setNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP Securimage::setNamespace方法的具体用法?PHP Securimage::setNamespace怎么用?PHP Securimage::setNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Securimage
的用法示例。
在下文中一共展示了Securimage::setNamespace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: securimages_play
public function securimages_play()
{
$options = array('use_database' => true, 'database_name' => '', 'database_user' => '', 'database_driver' => Securimage::SI_DRIVER_MYSQL);
$img = new Securimage();
// Other audio settings
//$img->audio_use_sox = true;
//$img->audio_use_noise = true;
//$img->degrade_audio = false;
//$img->sox_binary_path = 'sox';
// To use an alternate language, uncomment the following and download the files from phpcaptcha.org
// $img->audio_path = $img->securimage_path . '/audio/es/';
// If you have more than one captcha on a page, one must use a custom namespace
// $img->namespace = 'form2';
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
return $img->outputAudioFile();
}
示例3: dirname
* If you found this script useful, please take a quick moment to rate it.<br />
* http://www.hotscripts.com/rate/49400.html Thanks.
*
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
* @copyright 2012 Drew Phillips
* @author Drew Phillips <drew@drew-phillips.com>
* @version 3.5.2 (Feb 15, 2014)
* @package Securimage
*
*/
require_once dirname(__FILE__) . '/securimage.php';
// if using database, adjust these options as necessary and change $img = new Securimage(); to $img = new Securimage($options);
// see test.mysql.php or test.sqlite.php for examples
$options = array('use_database' => true, 'database_name' => '', 'database_user' => '', 'database_driver' => Securimage::SI_DRIVER_MYSQL);
$img = new Securimage();
// Other audio settings
//$img->audio_use_sox = true;
//$img->audio_use_noise = true;
//$img->degrade_audio = false;
//$img->sox_binary_path = 'sox';
// To use an alternate language, uncomment the following and download the files from phpcaptcha.org
// $img->audio_path = $img->securimage_path . '/audio/es/';
// If you have more than one captcha on a page, one must use a custom namespace
// $img->namespace = 'form2';
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) {
$img->setNamespace($_GET['namespace']);
}
$img->outputAudioFile();
示例4: Securimage
$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->image_signature = 'Bank of Muenchen';
$img->signature_color = new Securimage_Color('#0066FF');
$img->show(); // outputs the image and content headers to the browser
// alternate use:
// $img->show('/path/to/background_image.jpg');
示例5: isValid
public static function isValid($captcha_name, $code_captcha)
{
$img = new Securimage();
$img->setNamespace($captcha_name);
return $img->check($code_captcha);
}
示例6: function
// Register route for captcha image generation
kirby()->routes(array(array('pattern' => 'captcha', 'action' => function () {
$img = new Securimage();
$img->case_sensitive = c::get('captcha.case_sensitive', true);
$img->perturbation = c::get('captcha.perturbation', 0.75);
$img->num_lines = c::get('captcha.num_lines', 8);
$img->charset = c::get('captcha.charset', 'ABCDEFGHJKMNPQRSTVWXYZ');
if (c::get('captcha.ttf_file')) {
$img->ttf_file = c::get('captcha.ttf_file');
}
if (c::get('captcha.height')) {
$img->image_height = c::get('captcha.height');
}
if (c::get('captcha.width')) {
$img->image_width = c::get('captcha.width');
}
if (c::get('captcha.bg_color')) {
$img->image_bg_color = new Securimage_Color(c::get('captcha.bg_color'));
}
if (c::get('captcha.text_color')) {
$img->text_color = new Securimage_Color(c::get('captcha.text_color'));
}
if (c::get('captcha.line_color')) {
$img->line_color = new Securimage_Color(c::get('captcha.line_color'));
}
if (get('namespace')) {
$img->setNamespace(get('namespace'));
}
$img->show();
return false;
})));