Esempio n. 1
0
 private function createImage()
 {
     if ($this->img_ !== null) {
         imagedestory($this->img_);
     }
     $this->img_ = imagecreatetruecolor($this->width, $this->height);
     // background_color
     $gd_color = imagecolorallocate($this->img_, $this->background_color[0], $this->background_color[1], $this->background_color[2]);
     imagefilledrectangle($this->img_, 0, 0, $this->width, $this->height, $gd_color);
 }
                    imagefilter($canvas, $imgFilters[$fSettings[0]][0], $fSettings[1], $fSettings[2], $fSettings[3], $fSettings[4]);
                    break;
                default:
                    imagefilter($canvas, $imgFilters[$fSettings[0]][0]);
                    break;
            }
        }
    }
    if ($s && function_exists('imageconvolution')) {
        $sMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1));
        $div = 0;
        $off = 0;
        imageconvolution($canvas, $sMatrix, $div, $off);
    }
    display_image($mime, $canvas);
    imagedestory($canvas);
    die;
} else {
    if (strlen($src)) {
        _error('src not found');
    } else {
        _error('no src defined');
    }
}
function check_source($src)
{
    return $src;
}
function get_query($variable, $default = 0)
{
    if (isset($_GET[$variable])) {
Esempio n. 3
0
<?php

header("Content-type:image/jpeg");
session_start();
$a = rand(0, 9);
$b = rand(0, 9);
$c = rand(0, 9);
$d = rand(0, 9);
$e = rand(0, 9);
$f = rand(0, 9);
$code = $a . $b . $c . $d . $e . $f;
session_register("check");
$_SESSION['check'] = $code;
$font = rand(1, 5) . ".ttf";
$im = imagecreate(100, 30);
$bg = imagecolorallocate($im, 33, 142, 18);
$color = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 15, rand(-3, 3), 10, 20, $color, $font, $code);
imagejpeg($im);
imagedestory($im);
Esempio n. 4
0
function create_tolerance($val_1, $val_2)
{
    header("Content-type: image/jpeg");
    $image = imageCreatetruecolor(35, 20);
    $white = imagecolorallocate($image, 255, 255, 255);
    imagefill($image, 0, 0, $white);
    $text_color = imagecolorallocate($image, 0, 0, 0);
    imagestring($image, 2, 0, 0, $val_1, $text_color);
    imagestring($image, 2, 0, 9, $val_2, $text_color);
    imagejpeg($image);
    //输出图像
    imagedestory($image);
    //销毁图像对像
}