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(); }
public function render(Captcha $c) { $dataUri = $this->encodeImage(new ImageCaptcha($c)); return '<img width="' . $c->getWidth() . '" height="' . $c->getHeight() . '" src="' . $dataUri . '" />'; }