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


PHP ImageRectangle函数代码示例

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


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

示例1: draw_captcha

function draw_captcha($security_code)
{
    //Set the image width and height
    $width = 100;
    $height = 25;
    //Create the image resource
    $image = ImageCreate($width, $height);
    if (function_exists('imageantialias')) {
        imageantialias($image, true);
    }
    //We are making three colors, white, black and gray
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 15, 50, 15);
    $grey = ImageColorAllocate($image, 204, 204, 204);
    $ellipsec = ImageColorAllocate($image, 0, 100, 60);
    //Make the background black
    ImageFill($image, 0, 0, $black);
    imagefilledellipse($image, 56, 15, 30, 17, $ellipsec);
    //Add randomly generated string in white to the image
    ImageString($image, 5, 30, 4, $security_code, $white);
    //Throw in some lines to make it a little bit harder for any bots to break
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $grey);
    imageline($image, 0, $height / 2 + 3, $width, $height / 2 + 5, $grey);
    imageline($image, $width / 2 - 14, 0, $width / 2 + 7, $height, $grey);
    //Tell the browser what kind of file is come in
    header("Content-Type: image/jpeg");
    //Output the newly created image in jpeg format
    ImageJpeg($image);
    //Free up resources
    ImageDestroy($image);
}
开发者ID:kuell,项目名称:chat,代码行数:31,代码来源:captcha.php

示例2: drawRating

function drawRating()
{
    $width = $_GET['width'];
    $height = $_GET['height'];
    if ($width == 0) {
        $width = 200;
    }
    if ($height == 0) {
        $height = 7;
    }
    $rating = $_GET['rating'];
    $ratingbar = $rating / 100 * $width - 2;
    $image = imagecreate($width, $height);
    $fill = ImageColorAllocate($image, 0, 255, 0);
    if ($rating > 49) {
        $fill = ImageColorAllocate($image, 255, 255, 0);
    }
    if ($rating > 74) {
        $fill = ImageColorAllocate($image, 255, 128, 0);
    }
    if ($rating > 89) {
        $fill = ImageColorAllocate($image, 255, 0, 0);
    }
    $back = ImageColorAllocate($image, 205, 205, 205);
    $border = ImageColorAllocate($image, 0, 0, 0);
    ImageFilledRectangle($image, 0, 0, $width - 1, $height - 1, $back);
    ImageFilledRectangle($image, 1, 1, $ratingbar, $height - 1, $fill);
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $border);
    imagePNG($image);
    imagedestroy($image);
}
开发者ID:SheppeR,项目名称:rapidleech,代码行数:31,代码来源:bar.php

示例3: create_image

function create_image()
{
    //Let's generate a totally random string using md5
    $md5_hash = md5(rand(0, 999));
    //We don't need a 32 character long string so we trim it down to 5
    $security_code = substr($md5_hash, 15, 5);
    //Set the session to store the security code
    $_SESSION["captchaCode"] = $security_code;
    //Set the image width and height
    $width = 100;
    $height = 20;
    //Create the image resource
    $image = ImageCreate($width, $height);
    //We are making three colors, white, black and gray
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 0, 0, 0);
    $grey = ImageColorAllocate($image, 204, 204, 204);
    //Make the background black
    ImageFill($image, 0, 0, $black);
    //Add randomly generated string in white to the image
    ImageString($image, 3, 30, 3, $security_code, $white);
    //Throw in some lines to make it a little bit harder for any bots to break
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $grey);
    imageline($image, 0, $height / 2, $width, $height / 2, $grey);
    imageline($image, $width / 2, 0, $width / 2, $height, $grey);
    //Tell the browser what kind of file is come in
    header("Content-Type: image/jpeg");
    //Output the newly created image in jpeg format
    ImageJpeg($image);
    //Free up resources
    ImageDestroy($image);
}
开发者ID:quachvancam,项目名称:sugardating,代码行数:32,代码来源:createImage.php

示例4: drawRating

function drawRating($rating) {
   $width = $_GET['width'];
   $height = $_GET['height'];
   if ($width == 0) {
     $width = 102;
   }
   if ($height == 0) {
     $height = 10;
   }

   $rating = $_GET['rating'];
   $ratingbar = (($rating/100)*$width)-2;

   $image = imagecreate($width,$height);
   //colors
   $back = ImageColorAllocate($image,255,255,255);
   $border = ImageColorAllocate($image,0,0,0);
   $red = ImageColorAllocate($image,255,60,75);
   $fill = ImageColorAllocate($image,44,81,150);

   ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
   ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
   ImageRectangle($image,0,0,$width-1,$height-1,$border);
   imagePNG($image);
   imagedestroy($image);
}
开发者ID:jasimmk,项目名称:DeveloperSupport,代码行数:26,代码来源:image.php

示例5: drawRating

function drawRating($rating, $max, $type)
{
    if ($type == 0) {
        $image = imagecreatetruecolor(102, 15);
        $back = ImageColorAllocate($image, 250, 250, 250);
        $border = ImageColorAllocate($image, 0, 0, 0);
        $fill = ImageColorAllocate($image, 0, 235, 0);
        ImageFilledRectangle($image, 0, 0, 101, 14, $back);
        ImageFilledRectangle($image, 1, 1, $rating / $max * 100, 14, $fill);
        ImageRectangle($image, 0, 0, 101, 14, $border);
        $textcolor = imagecolorallocate($image, 0, 0, 0);
        imagestring($image, 5, 35, 0, $rating / $max * 100 . '%', $textcolor);
    } else {
        if ($rating > $max) {
            $rating = $max;
        }
        $image = imagecreatetruecolor(10 * ($rating + 2) + 2, 15);
        $back = ImageColorAllocate($image, 250, 250, 250);
        $border = ImageColorAllocate($image, 0, 0, 0);
        $fill = ImageColorAllocate($image, 235, 0, 0);
        ImageFilledRectangle($image, 0, 0, 10 * ($rating + 2) + 1, 14, $back);
        ImageFilledRectangle($image, 1, 1, 10 * $rating, 14, $fill);
        ImageRectangle($image, 0, 0, 10 * $rating + 1, 14, $border);
        $textcolor = imagecolorallocate($image, 0, 0, 0);
        imagestring($image, 5, 10 * ($rating + 1), 0, $rating, $textcolor);
    }
    imagepng($image);
    imagedestroy($image);
}
开发者ID:noahrichards,项目名称:pb,代码行数:29,代码来源:pngbar.php

示例6: drawRating

function drawRating($rating)
{
    $width = 300;
    $height = 15;
    $ratingbar = $rating / 100 * $width - 2;
    $image = imagecreate($width, $height);
    $fill = ImageColorAllocate($image, 67, 219, 0);
    if ($rating > 74) {
        $fill = ImageColorAllocate($image, 233, 233, 0);
    }
    if ($rating > 89) {
        $fill = ImageColorAllocate($image, 197, 6, 6);
    }
    if ($rating > 100) {
        echo "Overload Error!";
        exit;
    }
    $back = ImageColorAllocate($image, 255, 255, 255);
    $border = ImageColorAllocate($image, 151, 151, 151);
    ImageFilledRectangle($image, 0, 0, $width - 1, $height - 1, $back);
    ImageFilledRectangle($image, 1, 1, $ratingbar, $height - 1, $fill);
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $border);
    imagePNG($image);
    imagedestroy($image);
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:25,代码来源:bar.php

示例7: display

 /**
  * Generates a random captcha image
  *
  **/
 function display($cachable = false, $urlparams = false)
 {
     // @TODO: Run some cleaning query here to clear the database.
     JTable::addIncludePath(DISCUSS_TABLES);
     $id = JRequest::getInt('captcha-id', '');
     $captcha = DiscussHelper::getTable('Captcha');
     // clearing the oudated keys.
     $captcha->clear();
     // load the captcha records.
     $captcha->load($id);
     if (!$captcha->id) {
         return false;
     }
     // @task: Generate a very random integer and take only 5 chars max.
     $hash = JString::substr(md5(rand(0, 9999)), 0, 5);
     $captcha->response = $hash;
     $captcha->store();
     // Captcha width and height
     $width = 100;
     $height = 20;
     $image = ImageCreate($width, $height);
     $white = ImageColorAllocate($image, 255, 255, 255);
     $black = ImageColorAllocate($image, 0, 0, 0);
     $gray = ImageColorAllocate($image, 204, 204, 204);
     ImageFill($image, 0, 0, $white);
     ImageString($image, 5, 30, 3, $hash, $black);
     ImageRectangle($image, 0, 0, $width - 1, $height - 1, $gray);
     imageline($image, 0, $height / 2, $width, $height / 2, $gray);
     imageline($image, $width / 2, 0, $width / 2, $height, $gray);
     header('Content-type: image/jpeg');
     ImageJpeg($image);
     ImageDestroy($image);
     exit;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:captcha.php

示例8: makeBorder

 private function makeBorder()
 {
     $bgcolor = ImageColorAllocate($this->image, $this->bordercolor[0], $this->bordercolor[1], $this->bordercolor[2]);
     // 邊框顏色
     ImageRectangle($this->image, 0, 0, $this->width - 1, $this->height - 1, $bgcolor);
     // 製作邊框
 }
开发者ID:anson852,项目名称:ALM-USE-CI,代码行数:7,代码来源:Captcha.php

示例9: createImage

 function createImage($_text, $_fontsize = 11)
 {
     /* create filename */
     $filename = 'button_' . md5($_text) . '.png';
     $filename = strtolower($filename);
     /* see if file exists already, we cache it */
     if (file_exists(PHPGW_IMAGES_FILEDIR . '/' . $filename)) {
         return $filename;
     }
     $size = imagettfbbox($_fontsize, 0, $this->font, $_text);
     $dx = abs($size[2] - $size[0]);
     $dy = abs($size[5] - $size[3]);
     $xpad = 9;
     $ypad = 9;
     $im = imagecreate($dx + $xpad, $dy + $ypad);
     $blue = ImageColorAllocate($im, 0x2c, 0x6d, 0xaf);
     $black = ImageColorAllocate($im, 0, 0, 0);
     $white = ImageColorAllocate($im, 255, 255, 255);
     ImageRectangle($im, 0, 0, $dx + $xpad - 1, $dy + $ypad - 1, $black);
     ImageRectangle($im, 0, 0, $dx + $xpad, $dy + $ypad, $white);
     ImageTTFText($im, $_fontsize, 0, (int) ($xpad / 2) + 1, $dy + (int) ($ypad / 2), -$black, $this->font, $_text);
     ImageTTFText($im, $_fontsize, 0, (int) ($xpad / 2), $dy + (int) ($ypad / 2) - 1, -$white, $this->font, $_text);
     ImagePNG($im, PHPGW_IMAGES_FILEDIR . '/' . $filename);
     ImageDestroy($im);
     return $filename;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:26,代码来源:class.graphics.inc.php

示例10: generate

 /**
  * Generates the captcha image
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function generate()
 {
     $id = $this->input->get('id', '', 'int');
     // Load up the captcha object
     $captcha = EB::table('Captcha');
     // Clear outdated keys
     $captcha->clear();
     // load the captcha records.
     $captcha->load($id);
     if (!$captcha->id) {
         return false;
     }
     // @task: Generate a very random integer and take only 5 chars max.
     $hash = JString::substr(md5(rand(0, 9999)), 0, 5);
     $captcha->response = $hash;
     $captcha->store();
     // Captcha width and height
     $width = 100;
     $height = 20;
     $image = ImageCreate($width, $height);
     $white = ImageColorAllocate($image, 255, 255, 255);
     $black = ImageColorAllocate($image, 0, 0, 0);
     $gray = ImageColorAllocate($image, 204, 204, 204);
     ImageFill($image, 0, 0, $white);
     ImageString($image, 5, 30, 3, $hash, $black);
     ImageRectangle($image, 0, 0, $width - 1, $height - 1, $gray);
     imageline($image, 0, $height / 2, $width, $height / 2, $gray);
     imageline($image, $width / 2, 0, $width / 2, $height, $gray);
     header('Content-type: image/jpeg');
     ImageJpeg($image);
     ImageDestroy($image);
     exit;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:captcha.php

示例11: create_image

 function create_image($string_captcha, $width = 130, $height = 35)
 {
     //Let's generate a totally random string using md5
     //    $md5_hash = md5(rand(0,999));
     //We don't need a 32 character long string so we trim it down to 5
     //    $security_code = substr($md5_hash, 15, 5);
     $security_code = $string_captcha;
     /* ********************************************
        Use this part if you need to Set the session 
        to store the security code                */
     $_SESSION['security_code'] = $security_code;
     $CodeInd = 0;
     $arrSecCode = array();
     $chars = preg_split('//', $security_code);
     $security_code = implode(" ", $chars);
     //Set the image width and height
     //$width = 130;
     //$height = 35;
     //Create the image resource
     $image = ImageCreate($width, $height);
     //We are making three colors, white, black and gray
     $arrB = array(0, 255, 129, 10, 48, 200, 186);
     $arrR = array(0, 255, 129, 111, 48, 210, 126);
     $arrG = array(0, 205, 139, 110, 48, 5, 186);
     $black = ImageColorAllocate($image, $arrR[rand(0, 6)], $arrG[rand(0, 6)], $arrB[rand(0, 6)]);
     $white = ImageColorAllocate($image, 255, 255, 255);
     $grey = ImageColorAllocate($image, 175, 253, 253);
     //Make the background black
     ImageFill($image, 0, 0, $black);
     $font = 5;
     $arrSel = array(1, 2, 3, 4);
     $selectedNum = $arrSel[rand(0, 3)];
     ImageString($image, $font, 10, 10, $security_code, $white);
     //Throw in some lines to make it a little bit harder for any bots to break
     ImageRectangle($image, 0, 0, $width - 1, $height - 1, $grey);
     if ($selectedNum == 1) {
         imageline($image, 0, $height / 2, $width, $height / 5, $grey);
         imageline($image, $width / 2, 0, $width / 3, $height / 5, $grey);
         imageline($image, $width / 2, 0, $width / 10, $height, $grey);
         imageline($image, $width / 2, 0, $width / 10, $height / 6, $grey);
     }
     if ($selectedNum == 2) {
         imageline($image, $width / 1, 0, $width / 6, $height, $grey);
         imageline($image, 0, $height / 5, $width, $height / 8, $grey);
         imageline($image, 0, $height / 5, $width / 5, $height / 8, $grey);
         imageline($image, 0, $height / 3, $width, $height, $grey);
     }
     if ($selectedNum == 3) {
         imageline($image, 0, $height, $width, 0, $grey);
         imageline($image, 0, 0, $height, $height, $grey);
         imageline($image, $width / 5, 0, $width / 6, $height, $grey);
         imageline($image, $width / 4, 0, $width / 4, $height, $grey);
     }
     //Tell the browser what kind of file is come in
     header("Content-Type: image/jpeg");
     //Output the newly created image in jpeg format
     ImageJpeg($image);
     //Free up resources
     ImageDestroy($image);
 }
开发者ID:ernesto-g,项目名称:conversorsubslatinos,代码行数:60,代码来源:imagecaptcha.php

示例12: doFilledBlock

function doFilledBlock()
{
    global $sx, $sy, $im, $pink, $black, $mark_v_offset;
    $width = 10;
    $height = 5;
    $ex = $sx + $width;
    $ey = $sy + $height + $mark_v_offset;
    ImageRectangle($im, $sx, $sy + $mark_v_offset, $ex, $ey, $pink);
    ImageFilledRectangle($im, $sx + 1, $sy + $mark_v_offset + 1, $ex - 1, $ey - 1, $black);
}
开发者ID:patmark,项目名称:care2x-tz,代码行数:10,代码来源:gd_test_request_chemlabor.php

示例13: drawBorder

function drawBorder(&$img, &$color, $thickness = 1)
{
    $x1 = 0;
    $y1 = 0;
    $x2 = ImageSX($img) - 1;
    $y2 = ImageSY($img) - 1;
    for ($i = 0; $i < $thickness; $i++) {
        ImageRectangle($img, $x1++, $y1++, $x2--, $y2--, $color_black);
    }
}
开发者ID:Alexzo20,项目名称:gesior-aac,代码行数:10,代码来源:generate.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;
     }
     /*
     $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

示例15: draw

function draw($lat, $lon, $color = NULL)
{
    global $im;
    global $offset;
    global $dot;
    if ($color == NULL) {
        $color = $dot;
    }
    $pt = getlocationcoords($lat, $long, imagesx($im), imagesy($im));
    ImageRectangle($im, $pt["x"] - $offset, $pt["y"], $pt["x"] + 1 - $offset, $pt["y"] + 1, $dot);
}
开发者ID:Galaxy421,项目名称:WOWMeter,代码行数:11,代码来源:map.php


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