Beispiel #1
0
    function drawPolygons()
    {
        for ($i = 1; $i <= $this->config["background_num"]; $i++) {
            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
            $coords = array();
            for ($j = 1; $j <= $this->config["polygon_point"]; $j++) {
                $coords[] = mt_rand(0, $this->width);
                $coords[] = mt_rand(0, $this->height);
            }
            imagefilledpolygon($this->oImage, $coords, $this->config["polygon_point"], $randomcolor);
        }
    }
    /**#@-*/
    /**
     *  Create CAPTCHA image with BMP
     *
     *  TODO
     */
    function createImageBmp($file = "")
    {
        $image = "";
        if (empty($file)) {
            header("Content-type: image/bmp");
            echo $image;
        } else {
            return $image;
        }
    }
}
$image_handler = new XoopsCaptchaImageHandler();
$image_handler->loadImage();
Beispiel #2
0
 public function test_createImageBmp()
 {
     Xoops::getInstance()->disableErrorReporting();
     $image_handler = new XoopsCaptchaImageHandler();
     $image_handler->mode = 'bmp';
     ob_start();
     $value = @$image_handler->createImageBmp('not_empty_string');
     ob_end_clean();
     $this->assertSame('', $value);
 }
Beispiel #3
0
    function drawPolygons()
    {
        for ($i = 1; $i <= $this->config["background_num"]; $i++) {
            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
            $coords = array();
            for ($j = 1; $j <= $this->config["polygon_point"]; $j++) {
                $coords[] = mt_rand(0, $this->width);
                $coords[] = mt_rand(0, $this->height);
            }
            imagefilledpolygon($this->oImage, $coords, $this->config["polygon_point"], $randomcolor);
        }
    }
    /**
     *  Create CAPTCHA iamge with BMP
     *  TODO
     */
    function createImageBmp($file = "")
    {
        $image = "";
        if (empty($file)) {
            header("Content-type: image/bmp");
            echo $image;
        } else {
            return $image;
        }
    }
}
$config = @(include "../config.php");
$image_handler = new XoopsCaptchaImageHandler();
$image_handler->setConfig($config);
$image_handler->loadImage();