当前位置: 首页>>代码示例>>PHP>>正文


PHP ImageLine函数代码示例

本文整理汇总了PHP中ImageLine函数的典型用法代码示例。如果您正苦于以下问题:PHP ImageLine函数的具体用法?PHP ImageLine怎么用?PHP ImageLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ImageLine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 function create($varDesc, $varValues)
 {
     Header("Content-type: image/png");
     $image = ImageCreate($this->imageWidth, $this->imageHeight);
     $bgcolor = ImageColorAllocate($image, $this->bgR, $this->bgG, $this->bgB);
     $white = ImageColorAllocate($image, 255, 255, 255);
     $black = ImageColorAllocate($image, 0, 0, 0);
     ImageFill($image, 0, 0, $bgcolor);
     $num = 0;
     foreach ($varDesc as $v) {
         $r = rand(0, 255);
         $g = rand(0, 255);
         $b = rand(0, 255);
         $sliceColors[$num] = ImageColorAllocate($image, $r, $g, $b);
         $num++;
     }
     // now $num has the number of elements
     // draw the box
     ImageLine($image, 0, 0, $this->imageWidth - 1, 0, $black);
     ImageLine($image, $this->imageWidth - 1, 0, $this->imageWidth - 1, $this->imageHeight - 1, $black);
     ImageLine($image, $this->imageWidth - 1, $this->imageHeight - 1, 0, $this->imageHeight - 1, $black);
     ImageLine($image, 0, $this->imageHeight - 1, 0, 0, $black);
     $total = 0;
     for ($x = 0; $x < $num; $x++) {
         $total += $varValues[$x];
     }
     // convert each slice into corresponding percentage of 360-degree circle
     for ($x = 0; $x < $num; $x++) {
         $angles[$x] = $varValues[$x] / $total * 360;
     }
     for ($x = 0; $x < $num; $x++) {
         // calculate and draw arc corresponding to each slice
         ImageArc($image, $this->imageWidth / 4, $this->imageHeight / 2, $this->imageWidth / 3, $this->imageHeight / 3, $angle, $angle + $angles[$x], $sliceColors[$x]);
         $angle = $angle + $angles[$x];
         $x1 = round($this->imageWidth / 4 + $this->imageWidth / 3 * cos($angle * pi() / 180) / 2);
         $y1 = round($this->imageHeight / 2 + $this->imageHeight / 3 * sin($angle * pi() / 180) / 2);
         // demarcate slice with another line
         ImageLine($image, $this->imageWidth / 4, $this->imageHeight / 2, $x1, $y1, $sliceColors[$x]);
     }
     // fill in the arcs
     $angle = 0;
     for ($x = 0; $x < $num; $x++) {
         $x1 = round($this->imageWidth / 4 + $this->imageWidth / 3 * cos(($angle + $angles[$x] / 2) * pi() / 180) / 4);
         $y1 = round($this->imageHeight / 2 + $this->imageHeight / 3 * sin(($angle + $angles[$x] / 2) * pi() / 180) / 4);
         ImageFill($image, $x1, $y1, $sliceColors[$x]);
         $angle = $angle + $angles[$x];
     }
     // put the desc strings
     ImageString($image, 5, $this->imageWidth / 2, 60, "Legend", $black);
     for ($x = 0; $x < $num; $x++) {
         $fl = sprintf("%.2f", $varValues[$x] * 100 / $total);
         $str = $varDesc[$x] . " (" . $fl . "%)";
         ImageString($image, 3, $this->imageWidth / 2, ($x + 5) * 20, $str, $sliceColors[$x]);
     }
     // put the title
     ImageString($image, 5, 20, 20, $this->title, $black);
     ImagePng($image);
     ImageDestroy($image);
 }
开发者ID:loopzy,项目名称:my,代码行数:59,代码来源:piemaker.php

示例2: generateImage

 function generateImage($token)
 {
     $iFont = 5;
     // Font ID
     $iSpacing = 2;
     // Spacing between characters
     $iDisplacement = 5;
     // Vertical chracter displacement
     // Establish font metric and image size
     $iCharWidth = ImageFontWidth($iFont);
     $iCharHeight = ImageFontHeight($iFont);
     $iWidth = strlen($token) * ($iCharWidth + $iSpacing);
     $iHeight = $iCharHeight + 2 * $iDisplacement;
     // Create the image
     $pic = ImageCreate($iWidth, $iHeight);
     // Allocate a background and foreground colour
     $col = array('white' => ImageColorAllocate($pic, 255, 255, 255), 'blue' => ImageColorAllocate($pic, 45, 45, 100), 'green' => ImageColorAllocate($pic, 45, 100, 45), 'red' => ImageColorAllocate($pic, 100, 45, 45), 'purple' => ImageColorAllocate($pic, 100, 45, 100), 'grey' => ImageColorAllocate($pic, 225, 225, 225), 'grey2' => ImageColorAllocate($pic, 200, 200, 200));
     for ($x = 0; $x < $iWidth; $x += 2) {
         for ($y = 0; $y < $iHeight; $y += 2) {
             ImageSetPixel($pic, $x, $y, $col['grey']);
         }
     }
     $iX = 1;
     for ($i = 0; $i < strlen($token); $i++) {
         ImageChar($pic, $iFont - 1, $iX, $iDisplacement - rand(-$iDisplacement, $iDisplacement), $token[$i], $col['grey2']);
         $iX += $iCharWidth + $iSpacing;
     }
     $iX = 2;
     $c = array('blue', 'green', 'red', 'purple');
     for ($i = 0; $i < strlen($token); $i++) {
         $colour = $c[rand(0, count($c) - 1)];
         ImageChar($pic, $iFont, $iX, $iDisplacement - rand(-$iDisplacement, $iDisplacement), $token[$i], $col[$colour]);
         $iX += $iCharWidth + $iSpacing;
     }
     for ($x = 1; $x < $iWidth; $x += 4) {
         for ($y = 1; $y < $iHeight; $y += 4) {
             ImageSetPixel($pic, $x, $y, $col['white']);
         }
     }
     // Draw some lines
     for ($i = 0; $i < 4; $i++) {
         ImageLine($pic, rand(0, $iWidth / 2), rand(0, $iHeight / 2), rand($iWidth / 2, $iWidth), rand($iHeight / 2, $iHeight), $col['white']);
     }
     ob_start();
     if (function_exists('imagejpeg')) {
         ImageJPEG($pic);
     } elseif (function_exists('imagepng')) {
         ImagePNG($pic);
     } else {
         ob_end_clean();
         return false;
     }
     $data = ob_get_contents();
     ob_end_clean();
     ImageDestroy($pic);
     return $data;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:57,代码来源:Turing.php

示例3: drawLines

function drawLines($image, $w, $h, $col, $top, $right, $left, $bottom)
{
    $gHeight = $h - ($top + $bottom);
    $space = $gHeight / 4;
    $y = $top;
    for ($a = 1; $a < 5; $a++) {
        ImageLine($image, $left, $y, $w - $right, $y, $col);
        $y = $y + $space;
    }
}
开发者ID:BackupTheBerlios,项目名称:yac-svn,代码行数:10,代码来源:graph.php

示例4: display

 function display($db_object, $common, $user_id, $default, $error_msg, $learning, $post_var)
 {
     $width = 340;
     $height = 220;
     //	$labelfont = '2';
     $labeltitlefont = '3';
     $image = ImageCreate($width, $height);
     while (list($kk, $vv) = @each($post_var)) {
         ${$kk} = $vv;
     }
     /*
     $to_date=2004-01-02;
     $from_date=2004-01-02;
     $avg_rater=50.23;
     */
     $bgcolor = ImageColorAllocate($image, 0xffffff, 0xffffff, 0xffffff);
     $border = ImageColorAllocate($image, 0x0, 0x0, 0x0);
     $border1 = ImageColorAllocate($image, 0xcccccc, 0x0, 0x0);
     //$border2 = ImageColorAllocate($image,0x000000, 0xcccccc, 0x000000);
     ImageRectangle($image, 40, 20, 240, 160, $border);
     ImageString($image, $labelfont, 15, 20, "100%", $border);
     ImageString($image, $labelfont, 20, 55, "75%", $border);
     ImageString($image, $labelfont, 20, 90, "50%", $border);
     ImageString($image, $labelfont, 20, 125, "25%", $border);
     ImageString($image, $labelfont, 20, 155, "0%", $border);
     $fdate = $learning->changedate_display($from_date);
     $tdate = $learning->changedate_display($to_date);
     $days = $error_msg['cDays'] . " {$fdate} " . $error_msg['cTo'] . " {$tdate} ";
     $avg_rt = @explode(",", $avg_rater);
     $id = @explode(",", $ids);
     for ($i = 0; $i < count($avg_rt); $i++) {
         $p1 = rand(0, 200);
         $p2 = rand(30, 250);
         $p3 = rand(100, 250);
         $color = imagecolorallocate($image, $p1, $p2, $p3);
         $avg = $avg_rt[$i];
         $avg_comp = 160 - 140 / 100 * $avg;
         $avg = round($avg, 2);
         $rid = $id[$i];
         $rname = $common->name_display($db_object, $rid);
         ImageStringUp($image, $labeltitlefont, 5, 110, $error_msg['cResults'], $border);
         ImageString($image, $labeltitlefont, 245, 20, $error_msg['cCommitment'], $border);
         ImageString($image, $labeltitlefont, 50, 170, "{$days}", $border);
         //ImageString($image, $labeltitlefont, 50,180, "$rname", $color);
         ImageLine($image, 240, 20, 40, 160, $border1);
         //COMMITMENT LINE
         ImageLine($image, 240, $avg_comp, 40, 160, $color);
         //AVERAGE COMPLETION
         header("Content-type: image/png");
         // or "Content-type: image/png"
         Imagepng($image);
         // or imagepng($image)
     }
     ImageDestroy($image);
 }
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:55,代码来源:graph_learning_status.php

示例5: callback

 function callback($img, $arg)
 {
     #fwrite(STDERR, "callback in object: arg=" . print_r($arg, True) . "\nimg=" . print_r($img, True) . "\n");
     # fwrite(STDERR, print_r($this, True));
     #fwrite(STDERR, "Plot area: ({$this->plot_area[0]}, {$this->plot_area[1]}) :");
     #fwrite(STDERR, " ({$this->plot_area[2]}, {$this->plot_area[2]})\n");
     # Draw an X across the plot area.
     $red = ImageColorResolve($img, 255, 0, 0);
     ImageLine($img, $this->plot_area[0], $this->plot_area[1], $this->plot_area[2], $this->plot_area[3], $red);
     ImageLine($img, $this->plot_area[0], $this->plot_area[3], $this->plot_area[2], $this->plot_area[1], $red);
 }
开发者ID:myfarms,项目名称:PHPlot,代码行数:11,代码来源:callback2.php

示例6: _create_captha_img

/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
function _create_captha_img()
{
    $width = 100;
    $height = 25;
    $im = @imagecreate($width, $height) or die("Cannot initialize new GD image stream!");
    if (isset($_GET['image']) and isset($_GET['page'])) {
        $char = md5($_GET['image'] . $_GET['page']);
    } else {
        die("error");
    }
    $char = str_replace(array('a', 'b', 'c', 'd', 'e', 'f'), array('0', '5', '8', '3', '4', '7'), $char);
    $char = substr($char, 1, 4);
    imagecolortransparent($im, imagecolorallocate($im, 205, 255, 255));
    // rnd
    for ($i = 0; $i < strlen($char); $i++) {
        // $text_color = imagecolorallocate ($im, rand(220,255), rand(0,40), 120);
        $text_color = imagecolorallocate($im, 255, 0, 0);
        $x = $width / 10 + $i * ($width / 5);
        // $y = rand(0, 5);
        $y = 0;
        imagechar($im, 4, $x, $y, chr(rand(49, 90)), $text_color);
    }
    $point_color = imagecolorallocate($im, 255, 120, 120);
    ImageLine($im, 3, 9, 150, 2, $point_color);
    //output characters
    for ($i = 0; $i < strlen($char); $i++) {
        $text_color = imagecolorallocate($im, rand(0, 120), rand(0, 180), rand(0, 180));
        // $x = 5 + $i * 40 + rand(-5, 5);
        $x = 3 + $i * $width / 4;
        //$y = rand(0, 5);
        $y = 10;
        imagechar($im, 5, $x, $y, $char[$i], $text_color);
    }
    //ouput PNG
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // HTTP/1.1
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    //	HTTP/1.0
    if (function_exists("imagepng")) {
        header("Content-type: image/png");
        imagepng($im);
    } elseif (function_exists("imagegif")) {
        header("Content-type: image/gif");
        imagegif($im);
    } elseif (function_exists("imagejpeg")) {
        header("Content-type: image/jpeg");
        imagejpeg($im);
    } else {
        die("No image support in this PHP server!");
    }
    imagedestroy($im);
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:58,代码来源:img.php

示例7: show_gd_img

function show_gd_img($content = "")
{
    $content = '  ' . preg_replace("/(\\w)/", "\\1 ", $content) . ' ';
    $gd_version = 2;
    @header("Content-Type: image/jpeg");
    $tmp_x = 140;
    $tmp_y = 20;
    $image_x = 210;
    $image_y = 65;
    $circles = 3;
    if ($gd_version == 1) {
        $tmp = imagecreate($tmp_x, $tmp_y);
        $im = imagecreate($image_x, $image_y);
    } else {
        $tmp = imagecreatetruecolor($tmp_x, $tmp_y);
        $im = imagecreatetruecolor($image_x, $image_y);
    }
    $white = ImageColorAllocate($tmp, 255, 255, 255);
    $black = ImageColorAllocate($tmp, 0, 0, 0);
    $grey = ImageColorAllocate($tmp, 210, 210, 210);
    imagefill($tmp, 0, 0, $white);
    for ($i = 1; $i <= $circles; $i++) {
        $values = array(0 => rand(0, $tmp_x - 10), 1 => rand(0, $tmp_y - 3), 2 => rand(0, $tmp_x - 10), 3 => rand(0, $tmp_y - 3), 4 => rand(0, $tmp_x - 10), 5 => rand(0, $tmp_y - 3), 6 => rand(0, $tmp_x - 10), 7 => rand(0, $tmp_y - 3), 8 => rand(0, $tmp_x - 10), 9 => rand(0, $tmp_y - 3), 10 => rand(0, $tmp_x - 10), 11 => rand(0, $tmp_y - 3));
        $randomcolor = imagecolorallocate($tmp, rand(100, 255), rand(100, 255), rand(100, 255));
        imagefilledpolygon($tmp, $values, 6, $randomcolor);
    }
    imagestring($tmp, 5, 0, 2, $content, $black);
    //-----------------------------------------
    // Distort by resizing
    //-----------------------------------------
    imagecopyresized($im, $tmp, 0, 0, 0, 0, $image_x, $image_y, $tmp_x, $tmp_y);
    imagedestroy($tmp);
    $white = ImageColorAllocate($im, 255, 255, 255);
    $black = ImageColorAllocate($im, 0, 0, 0);
    $grey = ImageColorAllocate($im, 100, 100, 100);
    $random_pixels = $image_x * $image_y / 10;
    for ($i = 0; $i < $random_pixels; $i++) {
        ImageSetPixel($im, rand(0, $image_x), rand(0, $image_y), $black);
    }
    $no_x_lines = ($image_x - 1) / 5;
    for ($i = 0; $i <= $no_x_lines; $i++) {
        // X lines
        ImageLine($im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey);
        // Diag lines
        ImageLine($im, $i * $no_x_lines, 0, $i * $no_x_lines + $no_x_lines, $image_y, $grey);
    }
    $no_y_lines = ($image_y - 1) / 5;
    for ($i = 0; $i <= $no_y_lines; $i++) {
        ImageLine($im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey);
    }
    ImageJPEG($im);
    ImageDestroy($im);
    exit;
}
开发者ID:CHEZDESIGN,项目名称:mytorrent,代码行数:54,代码来源:GD_Security_image.php

示例8: linealfa

function linealfa ($alfa, $alfaold, $numcolor)
{
	global $xsize, $ysize, $im, $black, $color;
	$gradus = ($alfa + $alfaold)/2;
	$alfa = ($alfa * pi())/180;
	$x = $xsize/2 + ($xsize/2) * sin($alfa);
	$y = $ysize/2 - ($xsize/2) * cos($alfa);
	ImageLine($im, $xsize/2, $ysize/2, $x, $y, $black);

	$gradus = ($gradus * pi())/180;
	$x = $xsize/2 + ($xsize/3) * sin($gradus);
	$y = $ysize/2 - ($ysize/3) * cos($gradus);
	if ($gradus!=0) ImageFill($im, $x, $y, $color[$numcolor]);
}
开发者ID:nellka,项目名称:numiz-new,代码行数:14,代码来源:circle.ctl.php

示例9: _done

    /**
     * Output the plot
     * @access private
     */
    function _done()
    {
        parent::_done();

        $p1 = false;
        $this->_dataset->_reset();
        while ($point = $this->_dataset->_next()) {
            $p2['X'] = $this->_parent->_pointX($point);
            $p2['Y'] = $this->_parent->_pointY($point);
            if ($p1) {
                ImageLine($this->_canvas(), $p1['X'], $p1['Y'], $p2['X'], $p2['Y'], $this->_getLineStyle());
            }
            $p1 = $p2;
        }
        $this->_drawMarker();
    }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:20,代码来源:Line.php

示例10: Generate

 function Generate()
 {
     $im = imagecreate(100, 50);
     $background_color = imagecolorallocate($im, 200, 200, 200);
     $text_color = imagecolorallocate($im, 233, 14, 91);
     $text_color = imagecolorallocate($im, 233, 14, 91);
     $_SESSION['SPAM_CHECKER_TEXT'] = substr(md5(time()), 4, 6);
     for ($i = 0; $i < rand(15, 20); $i++) {
         ImageLine($im, rand(0, 100), rand(0, 50), rand(0, 100), rand(0, 50), imagecolorallocate($im, rand(100, 150), rand(100, 150), rand(100, 150)));
     }
     $i = 1;
     for ($i = 0; $i < strlen($_SESSION['SPAM_CHECKER_TEXT']); $i++) {
         $text_color = imagecolorallocate($im, rand(10, 50), rand(10, 50), rand(10, 50));
         imagettftext($im, rand(12, 15), rand(0, 20), 15 + $i * 15, rand(20, 35), $text_color, "arial.ttf", $_SESSION['SPAM_CHECKER_TEXT'][$i]);
     }
     header("Content-type: image/jpg");
     imagejpeg($im);
     imagedestroy($im);
 }
开发者ID:naffis,项目名称:rejectmail-php,代码行数:19,代码来源:check.mod.php

示例11: createGistagramm

 function createGistagramm($width, $heigth)
 {
     $image = @imagecreate($width, $heigth);
     $maxKey = findMaxKey($this->array);
     $maxValue = findMaxValue($this->array);
     ImageColorAllocate($image, 255, 255, 255);
     ImageLine($image, $this->align, $heigth - $this->align, $width - $this->align, $heigth - $this->align, 1);
     ImageLine($image, $this->align, $this->align, $this->align, $heigth - $this->align, 1);
     $widthRect = round(($width - 2 * $this->align) / ($maxKey + 1)) * $this->widthColumn;
     foreach ($this->array as $key => $value) {
         $color = getColor($image, $value, $maxValue);
         $heigthRect = round($value * ($heigth - 2 * $this->align) / $maxValue);
         $pos = round($key / ($maxKey + 1) * ($width - 2 * $this->align)) + $this->align;
         ImageFilledRectangle($image, $pos - $widthRect / 2, $heigth - $heigthRect, $pos + $widthRect / 2, $heigth - $this->align, $color);
         ImageString($image, 0, $pos - $widthRect / 2, $heigth - $heigthRect - 10, $value, 1);
         ImageString($image, 0, $pos - $widthRect / 2, $heigth - $this->align, $key, 1);
     }
     $this->image = $image;
 }
开发者ID:mpospelov,项目名称:fedoruk_php,代码行数:19,代码来源:GistagrammClass.php

示例12: guvenlikKodu

 public function guvenlikKodu()
 {
     $kod = substr(md5(rand(0, 999999999999.0)), -6);
     if ($kod) {
         $this->session->set_userdata("guvKod", $kod);
         $width = 100;
         $height = 30;
         $resim = ImageCreate($width, $height);
         $beyaz = ImageColorAllocate($resim, 255, 255, 255);
         $rand = ImageColorAllocate($resim, rand(0, 255), rand(0, 255), rand(0, 255));
         ImageFill($resim, 0, 0, $rand);
         ImageString($resim, 5, 24, 7, $this->session->userdata("guvKod"), $beyaz);
         ImageLine($resim, 100, 19, 0, 19, $beyaz);
         header("Content,type:image/png");
         ImagePng($resim);
         ImageDestroy($resim);
         $this->session->set_userdata("guvKod2", $this->session->userdata("guvKod"));
     }
 }
开发者ID:ufukpalavar52,项目名称:demo-uygulamam,代码行数:19,代码来源:Pages.php

示例13: cs_captcha

function cs_captcha($hash)
{
    $gd_info = gd_info();
    $chars = strlen($hash);
    $height = $chars == 3 ? 18 : 40;
    $charsize = $chars * 20;
    $img = ImageCreateTrueColor($charsize, $height);
    $bgc = ImageColorAllocate($img, rand(0, 80), rand(0, 80), rand(0, 80));
    ImageFill($img, 0, 0, $bgc);
    for ($i = 1; $i < $chars; $i++) {
        $linecolor = ImageColorAllocate($img, rand(0, 150), rand(0, 150), rand(0, 150));
        ImageLine($img, $i * 20, 0, $i * 20, $height, $linecolor);
    }
    $linecolor = ImageColorAllocate($img, rand(0, 150), rand(0, 150), rand(0, 150));
    ImageLine($img, 0, $height / 3, $charsize, $height / 3, $linecolor);
    $linecolor = ImageColorAllocate($img, rand(0, 150), rand(0, 150), rand(0, 150));
    ImageLine($img, 0, $height / 3 * 2, $charsize, $height / 3 * 2, $linecolor);
    $linecolor = ImageColorAllocate($img, 0, 0, 0);
    ImageLine($img, 0, 0, $charsize, 0, $linecolor);
    ImageLine($img, 0, $height - 1, $charsize, $height - 1, $linecolor);
    ImageLine($img, 0, 0, 0, $height - 1, $linecolor);
    ImageLine($img, $charsize - 1, 0, $charsize - 1, $height - 1, $linecolor);
    for ($i = 0; $i < $chars; $i++) {
        $textcolor = ImageColorAllocate($img, rand(100, 250), rand(100, 250), rand(100, 250));
        ImageString($img, rand(3, 5), rand($i * 20 + 2, $i * 20 + 8), rand(2, $height - 20), $hash[$i], $textcolor);
    }
    # disable browser / proxy caching
    header("Cache-Control: max-age=0, no-cache, no-store, must-revalidate");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    if (!empty($gd_info["PNG Support"])) {
        header("Content-type:image/png");
        ImagePNG($img);
    } elseif (!empty($gd_info["JPG Support"]) or !empty($gd_info["JPEG Support"])) {
        header("Content-type:image/jpg");
        ImageJPEG($img);
    } elseif (!empty($gd_info["GIF Create Support"])) {
        header("Content-type:image/gif");
        ImageGIF($img);
    } else {
        cs_error(__FILE__, 'Could not create image file using GD');
    }
}
开发者ID:aberrios,项目名称:WEBTHESGO,代码行数:42,代码来源:gd.php

示例14: display

 function display($db_object, $common, $user_id, $default, $error_msg, $learning, $post_var)
 {
     $width = 340;
     $height = 220;
     //	$labelfont = '2';
     $labeltitlefont = '3';
     $image = ImageCreate($width, $height);
     while (list($kk, $vv) = @each($post_var)) {
         ${$kk} = $vv;
     }
     $bgcolor = ImageColorAllocate($image, 0xffffff, 0xffffff, 0xffffff);
     $border = ImageColorAllocate($image, 0x0, 0x0, 0x0);
     $border1 = ImageColorAllocate($image, 0xcccccc, 0x0, 0x0);
     $border2 = ImageColorAllocate($image, 0x0, 0xcccccc, 0x0);
     ImageRectangle($image, 40, 20, 240, 160, $border);
     ImageString($image, $labelfont, 15, 20, "100%", $border);
     ImageString($image, $labelfont, 20, 55, "75%", $border);
     ImageString($image, $labelfont, 20, 90, "50%", $border);
     ImageString($image, $labelfont, 20, 125, "25%", $border);
     ImageString($image, $labelfont, 20, 155, "0%", $border);
     $fdate = $learning->changedate_display($from_date);
     $tdate = $learning->changedate_display($to_date);
     $days = $error_msg['cDays'] . " {$fdate} " . $error_msg['cTo'] . " {$tdate} ";
     $avg_comp = 160 - 140 / 100 * $avg;
     $avg = round($avg, 2);
     ImageStringUp($image, $labeltitlefont, 5, 110, $error_msg['cResults'], $border);
     ImageString($image, $labeltitlefont, 245, 20, $error_msg['cCommitment'], $border);
     ImageString($image, $labeltitlefont, 50, 170, "{$days}", $border);
     ImageString($image, $labeltitlefont, 50, 200, $error_msg['cCTimelyCompletionofActivities'], $border);
     ImageString($image, $labeltitlefont, 50, 185, $error_msg['cAverage'], $border);
     ImageString($image, $labeltitlefont, 115, 185, $avg, $border);
     ImageLine($image, 240, 20, 40, 160, $border1);
     //COMMITMENT LINE
     ImageLine($image, 240, $avg_comp, 40, 160, $border2);
     //AVERAGE COMPLETION
     ImageString($image, $labeltitlefont, 245, $avg_comp, $error_msg['cAccomplishment'], $border);
     header("Content-type: image/png");
     // or "Content-type: image/png"
     Imagepng($image);
     // or imagepng($image)
     ImageDestroy($image);
 }
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:42,代码来源:graph_results.php

示例15: createImage

function createImage($text, $width, $height, $font = 5)
{
    global $fontColor, $bgColor, $lineColor;
    if ($img = @ImageCreate($width, $height)) {
        list($R, $G, $B) = convertRGB($fontColor);
        $fontColor = ImageColorAllocate($img, $R, $G, $B);
        list($R, $G, $B) = convertRGB($bgColor);
        $bgColor = ImageColorAllocate($img, $R, $G, $B);
        list($R, $G, $B) = convertRGB($lineColor);
        $lineColor = ImageColorAllocate($img, $R, $G, $B);
        ImageFill($img, 0, 0, $bgColor);
        for ($i = 0; $i <= $width; $i += 5) {
            @ImageLine($img, $i, 0, $i, $height, $lineColor);
        }
        for ($i = 0; $i <= $height; $i += 5) {
            @ImageLine($img, 0, $i, $width, $i, $lineColor);
        }
        $hcenter = $width / 2;
        $vcenter = $height / 2;
        $x = round($hcenter - ImageFontWidth($font) * strlen($text) / 2);
        $y = round($vcenter - ImageFontHeight($font) / 2);
        ImageString($img, $font, $x, $y, $text, $fontColor);
        if (function_exists('ImagePNG')) {
            header('Content-Type: image/png');
            @ImagePNG($img);
        } else {
            if (function_exists('ImageGIF')) {
                header('Content-Type: image/gif');
                @ImageGIF($img);
            } else {
                if (function_exists('ImageJPEG')) {
                    header('Content-Type: image/jpeg');
                    @ImageJPEG($img);
                }
            }
        }
        ImageDestroy($img);
    }
}
开发者ID:ghahremany,项目名称:creat-TAG,代码行数:39,代码来源:image.php


注:本文中的ImageLine函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。