本文整理汇总了PHP中Captcha::getWidth方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::getWidth方法的具体用法?PHP Captcha::getWidth怎么用?PHP Captcha::getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Captcha
的用法示例。
在下文中一共展示了Captcha::getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Captcha $c)
{
$this->captcha = $c;
// TODO: random lines
$this->lines = [['x1' => 0, 'y1' => $c->getWidth() / 2, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 2, 'color' => '#00ff00', 'width' => 1], ['x1' => 0, 'y1' => 10, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 1.3, 'color' => '#cccccc', 'width' => 2], ['x1' => 0, 'y1' => $c->getHeight() / 2, 'x2' => $c->getWidth(), 'y2' => $c->getHeight() / 3, 'color' => '#cccccc', 'width' => 2]];
$this->fontSize = 12;
$this->borderColor = '#666666';
$this->backgroundColor = '#f1f1f1';
$this->textColor = '#333333';
$this->text = $c->getGenerateValue();
}
示例2: render
public function render(Captcha $c)
{
$dataUri = $this->encodeImage(new ImageCaptcha($c));
return '<img width="' . $c->getWidth() . '" height="' . $c->getHeight() . '" src="' . $dataUri . '" />';
}