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


PHP ImageFill函数代码示例

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


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

示例1: MyImageBlur

function MyImageBlur($im, $pct) {
	// w00t. my very own blur function
	// in GD2, there's a gaussian blur function. smarmy bastards. ;-)
	$width = imagesx($im);
	$height = imagesy($im);
	$temp_im = ImageCreate($width, $height);
	$bg = ImageColorAllocate($temp_im, 255, 255, 255);
	// preserves transparency if in orig image
	ImageColorTransparent($temp_im, $bg);
	// fill bg
	ImageFill($temp_im, 0, 0, $bg);
	$distance = 1;
	// emboss:
	ImageCopyMerge($temp_im, $im, 0, 0, $distance, $distance, $width, $height, $pct);
	ImageCopyMerge($im, $temp_im, -$distance, -$distance, 0, 0, $width, $height, $pct);
	ImageFill($temp_im, 0, 0, $bg);
	ImageCopyMerge($temp_im, $im, 0, $distance, $distance, 0, $width, $height, $pct);
	ImageCopyMerge($im, $temp_im, $distance, 0, 0, $distance, $width, $height, $pct);
	// blur:
	ImageCopyMerge($temp_im, $im, 0, $distance, 0, 0, $width, $height, $pct);
	ImageCopyMerge($im, $temp_im, $distance, 0, 0, 0, $width, $height, $pct);
	ImageCopyMerge($temp_im, $im, 0, 0, 0, $distance, $width, $height, $pct);
	ImageCopyMerge($im, $temp_im, 0, 0, $distance, 0, $width, $height, $pct);
	// remove temp image
	ImageDestroy($temp_im);
	return $im;
}
开发者ID:Naddiseo,项目名称:WW2Game,代码行数:27,代码来源:imageclick.php

示例2: capcha

function capcha($salt)
{
    srand(time());
    $md5_hash = md5(rand(0, 9999));
    $security_code = substr($md5_hash, 25, 5);
    $enc = md5($security_code . $salt);
    $_SESSION['count'] = $enc;
    $secure = $_SESSION['count'];
    // echo "--------------------------$secure<br>";
    $width = 50;
    $height = 24;
    $image = ImageCreate($width, $height);
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 0, 100, 0);
    $grey = ImageColorAllocate($image, 204, 204, 204);
    ImageFill($image, 0, 0, $white);
    //Add randomly generated string in white to the image
    ImageString($image, 10, 4, 4, $security_code, $black);
    // ImageRectangle($image,0,16,$width-1,$height-1,$grey);
    imageline($image, 0, $height / 2, $width, $height / 2, $grey);
    imageline($image, $width / 2, 0, $width / 2, $height, $grey);
    header("Content-Type: image/jpeg");
    header("Cache-Control: no-cache, must-revalidate");
    ImageJpeg($image);
    ImageDestroy($image);
}
开发者ID:akalend,项目名称:test,代码行数:26,代码来源:capcha.php

示例3: guvenlik_resmi

 function guvenlik_resmi()
 {
     $sifre = substr(md5(rand(0, 999999999999)), -5);
     if ($sifre) {
         $this->session->set_userdata('koruma', $sifre);
         $yukseklik = 62;
         $genislik = 200;
         $resim = ImageCreate($genislik, $yukseklik);
         $siyah = ImageColorAllocate($resim, 0, 0, 0);
         $kirmizi = ImageColorAllocate($resim, 182, 16, 99);
         $beyaz = ImageColorAllocate($resim, 255, 255, 255);
         ImageFill($resim, 0, 0, $beyaz);
         $font = 'css/comic.ttf';
         $font_boyut = 24;
         $sM = 30;
         $uM = 45;
         //kullanımı
         //resim adı, font boyutu, yazının açısı, yazının soldan margini, üstten margin, renk, font adı, şifrenin hangi digitinin yazılacağı bellirtiliyor
         imagettftext($resim, $font_boyut, rand(-45, 45), $sMa = $sM, $uM, rand(0, 255), $font, $sifre[0]);
         imagettftext($resim, $font_boyut, rand(-45, 45), $sM = $sMa + $sM, $uM, rand(0, 255), $font, $sifre[1]);
         imagettftext($resim, $font_boyut, rand(-45, 45), $sM = $sMa + $sM, $uM, rand(0, 255), $font, $sifre[2]);
         imagettftext($resim, $font_boyut, rand(-45, 45), $sM = $sMa + $sM, $uM, rand(0, 255), $font, $sifre[3]);
         imagettftext($resim, $font_boyut, rand(-45, 45), $sM = $sMa + $sM, $uM, rand(0, 255), $font, $sifre[4]);
         //ImageRectangle($resim, 0, 0, $genislik-1, $yukseklik-1, $kirmizi);
         imageline($resim, 0, $yukseklik / 2, $genislik, $yukseklik / 2, $kirmizi);
         imageline($resim, $genislik / 2, 0, $genislik / 2, $yukseklik, $kirmizi);
         header("Content-Type: image/png");
         ImagePng($resim);
         ImageDestroy($resim);
     }
     exit;
 }
开发者ID:alyayazilim,项目名称:Servis-Takip,代码行数:32,代码来源:Sistem_yonetimi.php

示例4: 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

示例5: 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

示例6: DrawCanvas

 function DrawCanvas()
 {
     // Define canvas, so we don't go crazy
     $ca = $this->ca;
     ImageFill($this->graph, 0, 0, $this->canvas_size[0] - 1, $this->canvas_size[1] - 1, $this->color['background']);
     ImageFilledRectangle($this->graph, $ca[0], $ca[1], $ca[2], $ca[3], $this->color['canvas']);
     // Border lines
     ImageLine($this->graph, $ca[0], $ca[1], $ca[0], $ca[3], $this->color['border']);
     ImageLine($this->graph, $ca[2], $ca[1], $ca[2], $ca[3], $this->color['border']);
     ImageLine($this->graph, $ca[0], $ca[1], $ca[2], $ca[1], $this->color['border']);
     ImageLine($this->graph, $ca[0], $ca[3], $ca[2], $ca[3], $this->color['border']);
     // Draw 10ths horizonal and vertical
     $step = array(($ca[2] - $ca[0]) / $this->interval, ($ca[3] - $ca[1]) / $this->interval);
     for ($i = $ca[0] + $step[0]; $i <= $ca[2] - $step[0]; $i += $step[0]) {
         if ($this->options['dashed_grid']) {
             $this->_DashedLine($i, $ca[1] + 1, $i, $ca[3] - 1, $this->color['grid'], $this->color['background']);
         } else {
             ImageLine($this->graph, $i, $ca[1] + 1, $i, $ca[3] - 1, $this->color['grid']);
         }
     }
     for ($i = $ca[1] + $step[1]; $i <= $ca[3] - $step[1]; $i += $step[1]) {
         if ($this->options['dashed_grid']) {
             $this->_DashedLine($ca[0] + 1, $i, $ca[2] - 1, $i, $this->color['grid'], $this->color['background']);
         } else {
             ImageLine($this->graph, $ca[0] + 1, $i, $ca[2] - 1, $i, $this->color['grid']);
         }
     }
 }
开发者ID:rrsc,项目名称:freemed,代码行数:28,代码来源:GraphNormalize.class.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: createCaptcha

 /**
  * This function is used to create captcha
  * @access public
  * @param  int  $width      : Capach image width
  * @param  int  $height     : Captcha image height
  * @param  int  $length     : Captcha string length
  * @param  hex  $fontColor  : Captcha image font color code
  * @param  hex  $bgColor    : Captcha image background color code
  * @param  bool $pattern    : Captcha image pattern
  * @return image            : return captcha image
  **/
 public function createCaptcha($width = 150, $height = 50, $lenght = 5, $fontcolor = 0, $bgcolor = 4, $pattern = false)
 {
     /**
      * Set type to each variable to avoid any vulnarables
      *
      */
     $flag = settype($width, "int");
     $width = $flag === false ? 140 : $width;
     $flag = settype($height, 'integer');
     $height = $flag === false ? 50 : $height;
     $flag = settype($pattern, 'boolean');
     $pattern = $flag === false ? false : $pattern;
     /*
      * To create security code which is placed over the captcha image
      */
     $security_code = $this->createSecurityCode($lenght);
     /*
      * Store the generated security code to the session for the comaprion which the end user enter the code.
      * It also removing white spaces in the security code.
      */
     $_SESSION["security_code"] = md5(str_replace(" ", "", $security_code));
     /*
      *  create the image in specified width and height
      */
     $image = ImageCreate($width, $height);
     /*
      * set font color
      */
     $this->font_color = $this->setColor($image, $fontcolor);
     /*
      * set background color
      */
     $this->bg_color = $this->setColor($image, $bgcolor);
     /*
      * Create background
      */
     ImageFill($image, 0, 0, $this->bg_color);
     /*
      * Generate noice
      */
     if ($pattern) {
         $this->generateNoice($image, 100, $width, $height, 10);
     }
     /*
      *  Write security code on the image
      */
     $width = ($width - strlen($security_code) * 7) / 2;
     ImageString($image, 4, (int) $width, $height / 4, $security_code, $this->font_color);
     //ImageRectangle($image,0,0,$width-1,$height-1,$grey);
     /*
      * Rendering to image
      */
     header("Content-Type: image/jpeg");
     ImageJpeg($image);
     ImageDestroy($image);
 }
开发者ID:mops1k,项目名称:NextFW,代码行数:67,代码来源:captcha.php

示例12: __construct

 function __construct()
 {
     header('Pragma: public');
     header('Cache-Control: max-age=86400');
     header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 86400));
     header('Content-Type: image/png');
     $this->image = ImageCreateTrueColor(96, 96);
     ImageSaveAlpha($this->image, true);
     ImageFill($this->image, 0, 0, ImageColorAllocateAlpha($this->image, 0, 0, 0, 127));
 }
开发者ID:dream123,项目名称:MapleBit,代码行数:10,代码来源:coordinates.php

示例13: image

 public static function image($id, $number)
 {
     $cheatForm = SecureFormModel::where('_id', $id)->get();
     if ($cheatForm->isEmpty()) {
         return false;
     } else {
         $image = ImageCreate(1, 1);
         $color = $cheatForm->first()->solution == $number ? ImageColorAllocate($image, 52, 152, 219) : ImageColorAllocate($image, 44, 62, 80);
         ImageFill($image, 0, 0, $color);
         return $image;
     }
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:12,代码来源:SecureFormManager.php

示例14: 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

示例15: display

	/**
	 * Generates a random captcha image
	 *
	 **/
	function display($cachable = false, $urlparams = false)
	{
		$id			= JRequest::getInt( 'captcha-id' , '' );
		$captcha	= Komento::getTable( 'Captcha' , 'KomentoTable' );

		if( ob_get_length() !== false )
		{
			while (@ ob_end_clean());
			if( function_exists( 'ob_clean' ) )
			{
				@ob_clean();
			}
		}

		// 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:kosmosby,项目名称:medicine-prof,代码行数:54,代码来源:captcha.php


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