/** * The constructor generates a Captcha image. * * @param int $dotNoise The dot noise level. Default: 100. * @param int $lineNoise The line noise level. Default: 5. * @param int $wordLen The length of the Captcha word. Default: 6. * @param int $timeout The timeout in seconds. Default: 1800. * @return OSS_Captcha_Image */ public function __construct($dotNoise = 100, $lineNoise = 5, $wordLen = 6, $timeout = 1800) { parent::__construct(); $captchaDir = OSS_Utils::getTempDir() . '/captchas'; if (!file_exists($captchaDir)) { mkdir($captchaDir, 0777, true); } if (strpos(dirname(__FILE__), 'src/') === false) { $font = dirname(__FILE__) . '/../../data/font/freeserif.ttf'; } else { $font = dirname(__FILE__) . '/../../../data/font/freeserif.ttf'; } $this->setTimeout($timeout)->setWordLen($wordLen)->setHeight(80)->setFont($font)->setFontSize(40)->setImgDir($captchaDir)->setDotNoiseLevel($dotNoise)->setLineNoiseLevel($lineNoise); return $this; }