/** * Generowanie tła * * @access public * @param Image_Captcha $image obiekt obrazu * @return void */ public function render(Image_Captcha $image) { for ($i = 0; $i <= $image->imageWidth(); $i += $this->step) { imageline($image->imageResource(), 0, $i, $image->imageWidth(), $i, $this->_color(is_array($this->color) ? $this->color[array_rand($this->color)] : $this->color, $image->imageResource())); imageline($image->imageResource(), $i, 0, $i, $image->imageHeight(), $this->_color(is_array($this->color) ? $this->color[array_rand($this->color)] : $this->color, $image->imageResource())); } imageline($image->imageResource(), 0, $image->imageHeight() - 1, $image->imageWidth(), $image->imageHeight() - 1, $this->_color(is_array($this->color) ? $this->color[array_rand($this->color)] : $this->color, $image->imageResource())); imageline($image->imageResource(), $image->imageWidth() - 1, 0, $image->imageWidth() - 1, $image->imageHeight(), $this->_color(is_array($this->color) ? $this->color[array_rand($this->color)] : $this->color, $image->imageResource())); }
/** * Generowanie tła * * @access public * @param Image_Captcha $image obiekt obrazu * @return void */ public function render(Image_Captcha $image) { $pts = array(); for ($i = 0; $i < round($image->imageWidth() / 1.5); $i++) { $x = rand(0, $image->imageWidth()); $y = rand(0, $image->imageHeight()); if (!in_array($x . '_' . $y, $pts)) { imageellipse($image->imageResource(), $x, $y, rand(2, 7), rand(3, 6), $this->_color(is_array($this->color) ? $this->color[array_rand($this->color)] : $this->color, $image->imageResource())); $pts[] = $x . '_' . $y; } else { $i--; } } }