• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imagefontheight函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_image

function create_image()
{
    // *** Generate a passcode using md5
    //	(it will be all lowercase hex letters and numbers ***
    $md5 = md5(rand(0, 9999));
    $pass = substr($md5, 10, 5);
    // *** Set the session cookie so we know what the passcode is ***
    $_SESSION["pass"] = $pass;
    // *** Create the image resource ***
    $image = ImageCreatetruecolor(100, 20);
    // *** We are making two colors, white and black ***
    $clr_white = ImageColorAllocate($image, 255, 255, 255);
    $clr_black = ImageColorAllocate($image, 0, 0, 0);
    // *** Make the background black ***
    imagefill($image, 0, 0, $clr_black);
    // *** Set the image height and width ***
    imagefontheight(15);
    imagefontwidth(15);
    // *** Add the passcode in white to the image ***
    imagestring($image, 5, 30, 3, $pass, $clr_white);
    // *** Throw in some lines to trick those cheeky bots! ***
    imageline($image, 5, 1, 50, 20, $clr_white);
    imageline($image, 60, 1, 96, 20, $clr_white);
    // *** Return the newly created image in jpeg format ***
    return imagejpeg($image);
    // *** Just in case... ***
    imagedestroy($image);
}
开发者ID:phpsa,项目名称:TheHostingTool,代码行数:28,代码来源:captcha_image.php


示例2: execute

 function execute($par)
 {
     global $wgRequest, $wgEmailImage;
     $size = 4;
     $text = $wgRequest->getText('img');
     /* decode this rubbish */
     $text = rawurldecode($text);
     $text = str_rot13($text);
     $text = base64_decode($text);
     $text = str_replace($wgEmailImage['ugly'], "", $text);
     $fontwidth = imagefontwidth($size);
     $fontheight = imagefontheight($size);
     $width = strlen($text) * $fontwidth + 4;
     $height = $fontheight + 2;
     $im = @imagecreatetruecolor($width, $height) or exit;
     $trans = imagecolorallocate($im, 0, 0, 0);
     /* must be black! */
     $color = imagecolorallocate($im, 1, 1, 1);
     /* nearly black ;) */
     imagecolortransparent($im, $trans);
     /* seems to work only with black! */
     imagestring($im, $size, 2, 0, $text, $color);
     //header ("Content-Type: image/png"); imagepng($im); => IE is just so bad!
     header("Content-Type: image/gif");
     imagegif($im);
     exit;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:27,代码来源:emailtag.php


示例3: __construct

 public function __construct($message, $iWidth = null, $iHeight = null)
 {
     $iFont = 2;
     if ($message instanceof Exception) {
         $message = $message->getMessage();
         if (defined('DEBUG') && DEBUG) {
             $message .= "\n" . $message->getTraceAsString();
         }
     }
     // calculate image size
     if ($iWidth == null || $iHeight != null) {
         $aMessage = explode("\n", $message);
         $iFontWidth = imagefontwidth($iFont);
         $iFontHeight = imagefontheight($iFont);
         foreach ($aMessage as $sLine) {
             $iHeight += $iFontHeight + 1;
             $iMessageWidth = $iFontWidth * (strlen($sLine) + 1);
             if ($iMessageWidth > $iWidth) {
                 $iWidth = $iMessageWidth;
             }
         }
         $iHeight += 8;
     }
     parent::__construct($iWidth, $iHeight);
     $iFontColor = $this->getColor(255, 0, 0);
     $iBorderColor = $this->getColor(255, 0, 0);
     $iBGColor = $this->getColor(255, 255, 255);
     $iPadding = 4;
     $this->fill(0, 0, $iBGColor);
     $this->drawRectangle(0, 0, $this->getWidth() - 1, $this->getHeight() - 1, $iBorderColor);
     $this->drawText($message, $iFont, $iFontColor, $iPadding, $iPadding);
 }
开发者ID:vulcandth,项目名称:steamprofile,代码行数:32,代码来源:ErrorImage.php


示例4: hide

 function hide($mail, $imgAttr = null)
 {
     // chequea si la librería GD esta instalada en el server
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         return $mail;
     }
     $filepath = IMAGES_URL . "mail/";
     $filename = $filepath . md5($mail) . ".png";
     $url = "mail/" . md5($mail) . ".png";
     if (!file_exists($filename)) {
         if (!is_dir($filepath)) {
             @mkdir($filepath);
         }
         /*calculo el tamaño que va a tener la imagen*/
         $width = imagefontwidth(3) * strlen($mail);
         $height = imagefontheight(3);
         $image = imagecreatetruecolor($width, $height);
         /*el color rojo lo uso como background transparente*/
         $white = imagecolorallocate($image, 255, 255, 255);
         $fontColor = ImageColorAllocate($image, 88, 88, 90);
         imagefill($image, 0, 0, $white);
         imagecolortransparent($image, $white);
         imagestring($image, 3, 0, 0, $mail, $fontColor);
         imagepng($image, $filename);
         imagedestroy($image);
     }
     return $this->Html->image($url, $imgAttr);
 }
开发者ID:Navdeep736,项目名称:regetp01,代码行数:28,代码来源:hide_mail.php


示例5: placeholder

 public static function placeholder($height, $width, $text)
 {
     // Dimensions
     //header ("Content-type: image/png");
     $getsize = $height . 'x' . $width;
     $dimensions = explode('x', $getsize);
     // Create image
     $image = imagecreate($dimensions[0], $dimensions[1]);
     // Colours
     $bg = 'ccc';
     $bg = Image::hex2rgb($bg);
     $setbg = imagecolorallocate($image, $bg['r'], $bg['g'], $bg['b']);
     $fg = '555';
     $fg = Image::hex2rgb($fg);
     $setfg = imagecolorallocate($image, $fg['r'], $fg['g'], $fg['b']);
     // Text
     //$text = isset($_GET['text']) ? strip_tags($_GET['text']) : $getsize;
     //$text = str_replace('+', ' ', $text);
     // Text positioning
     $fontsize = 4;
     $fontwidth = imagefontwidth($fontsize);
     // width of a character
     $fontheight = imagefontheight($fontsize);
     // height of a character
     $length = strlen($text);
     // number of characters
     $textwidth = $length * $fontwidth;
     // text width
     $xpos = (imagesx($image) - $textwidth) / 2;
     $ypos = (imagesy($image) - $fontheight) / 2;
     // Generate text
     imagestring($image, $fontsize, $xpos, $ypos, $text, $setfg);
     // Render image
     imagepng($image);
 }
开发者ID:nunonano,项目名称:ideprogram,代码行数:35,代码来源:Image.php


示例6: getVerify

 public function getVerify()
 {
     //创建画布
     $img = imagecreatetruecolor($this->config['width'], $this->config['height']);
     //设置背景颜色
     $bgColor = imagecolorallocate($img, 255, 255, 255);
     imagefill($img, 0, 0, $bgColor);
     $_x = ceil(($this->config['width'] - 20) / $this->config['lenght']);
     $code = '';
     //写入验证码
     for ($i = 0; $i < $this->config['lenght']; $i++) {
         $str = random();
         $code .= $str;
         $x = 10 + $i * $_x;
         $fontSize = mt_rand($this->config['fontsize'] - 10, $this->config['fontsize']);
         $fontH = imagefontheight($this->config['fontsize']);
         $y = mt_rand($fontH + 10, $this->config['height'] - 5);
         $fontColor = imagecolorallocate($img, mt_rand(0, 200), mt_rand(0, 200), mt_rand(0, 200));
         imagettftext($img, $fontSize, 0, $x, $y, $fontColor, $this->config['fontfile'], $str);
     }
     //增加干扰点
     for ($i = 0; $i < $this->config['point']; $i++) {
         $pointColor = imagecolorallocate($img, rand(150, 200), rand(150, 200), rand(100, 200));
         imagesetpixel($img, mt_rand(1, $this->config['width']), mt_rand(1, $this->config['height']), $pointColor);
     }
     //增加线干扰
     for ($i = 0; $i < $this->config['line']; $i++) {
         $linColor = imagecolorallocate($img, rand(0, 200), rand(0, 200), rand(0, 200));
         imageline($img, rand(0, $this->config['width']), rand(0, $this->config['height']), rand(0, $this->config['width']), rand(0, $this->config['height']), $linColor);
     }
     $_SESSION['Verify'] = md5(strtoupper($code));
     header('Content-type: image/png');
     imagepng($img);
     imagedestroy($img);
 }
开发者ID:lxpfigo,项目名称:blog,代码行数:35,代码来源:Verify.class.php


示例7: generateVerificationImg

 /**
  * Generates image
  *
  * @param string $sMac verification code
  *
  * @return null
  */
 function generateVerificationImg($sMac)
 {
     $iWidth = 80;
     $iHeight = 18;
     $iFontSize = 14;
     if (function_exists('imagecreatetruecolor')) {
         // GD2
         $oImage = imagecreatetruecolor($iWidth, $iHeight);
     } elseif (function_exists('imagecreate')) {
         // GD1
         $oImage = imagecreate($iWidth, $iHeight);
     } else {
         // GD not found
         return;
     }
     $iTextX = ($iWidth - strlen($sMac) * imagefontwidth($iFontSize)) / 2;
     $iTextY = ($iHeight - imagefontheight($iFontSize)) / 2;
     $aColors = array();
     $aColors["text"] = imagecolorallocate($oImage, 0, 0, 0);
     $aColors["shadow1"] = imagecolorallocate($oImage, 200, 200, 200);
     $aColors["shadow2"] = imagecolorallocate($oImage, 100, 100, 100);
     $aColors["background"] = imagecolorallocate($oImage, 255, 255, 255);
     $aColors["border"] = imagecolorallocate($oImage, 0, 0, 0);
     imagefill($oImage, 0, 0, $aColors["background"]);
     imagerectangle($oImage, 0, 0, $iWidth - 1, $iHeight - 1, $aColors["border"]);
     imagestring($oImage, $iFontSize, $iTextX + 1, $iTextY + 0, $sMac, $aColors["shadow2"]);
     imagestring($oImage, $iFontSize, $iTextX + 0, $iTextY + 1, $sMac, $aColors["shadow1"]);
     imagestring($oImage, $iFontSize, $iTextX, $iTextY, $sMac, $aColors["text"]);
     header('Content-type: image/png');
     imagepng($oImage);
     imagedestroy($oImage);
 }
开发者ID:ioanok,项目名称:symfoxid,代码行数:39,代码来源:verificationimg.php


示例8: build

 public function build($text = '', $showText = true, $fileName = null)
 {
     if (trim($text) <= ' ') {
         throw new exception('barCode::build - must be passed text to operate');
     }
     if (!($fileType = $this->outMode[$this->mode])) {
         throw new exception("barCode::build - unrecognized output format ({$this->mode})");
     }
     if (!function_exists("image{$this->mode}")) {
         throw new exception("barCode::build - unsupported output format ({$this->mode} - check phpinfo)");
     }
     $text = strtoupper($text);
     $dispText = "* {$text} *";
     $text = "*{$text}*";
     // adds start and stop chars
     $textLen = strlen($text);
     $barcodeWidth = $textLen * (7 * $this->bcThinWidth + 3 * $this->bcThickWidth) - $this->bcThinWidth;
     $im = imagecreate($barcodeWidth, $this->bcHeight);
     $black = imagecolorallocate($im, 0, 0, 0);
     $white = imagecolorallocate($im, 255, 255, 255);
     imagefill($im, 0, 0, $white);
     $xpos = 0;
     for ($idx = 0; $idx < $textLen; $idx++) {
         if (!($char = $text[$idx])) {
             $char = '-';
         }
         for ($ptr = 0; $ptr <= 8; $ptr++) {
             $elementWidth = $this->codeMap[$char][$ptr] ? $this->bcThickWidth : $this->bcThinWidth;
             if (($ptr + 1) % 2) {
                 imagefilledrectangle($im, $xpos, 0, $xpos + $elementWidth - 1, $this->bcHeight, $black);
             }
             $xpos += $elementWidth;
         }
         $xpos += $this->bcThinWidth;
     }
     if ($showText) {
         $pxWid = imagefontwidth($this->fontSize) * strlen($dispText) + 10;
         $pxHt = imagefontheight($this->fontSize) + 2;
         $bigCenter = $barcodeWidth / 2;
         $textCenter = $pxWid / 2;
         imagefilledrectangle($im, $bigCenter - $textCenter, $this->bcHeight - $pxHt, $bigCenter + $textCenter, $this->bcHeight, $white);
         imagestring($im, $this->fontSize, $bigCenter - $textCenter + 5, $this->bcHeight - $pxHt + 1, $dispText, $black);
     }
     if (!$fileName) {
         header("Content-type:  image/{$fileType}");
     }
     switch ($this->mode) {
         case 'gif':
             imagegif($im, $fileName);
         case 'png':
             imagepng($im, $fileName);
         case 'jpeg':
             imagejpeg($im, $fileName);
         case 'wbmp':
             imagewbmp($im, $fileName);
     }
     imagedestroy($im);
 }
开发者ID:arvinnizar,项目名称:elibrary,代码行数:58,代码来源:Barcode.php


示例9: DrawOwnerText

 function DrawOwnerText()
 {
     $iBlack = imagecolorallocate($this->oImage, 0, 0, 0);
     $iOwnerTextHeight = imagefontheight(2);
     $iLineHeight = $this->iHeight - $iOwnerTextHeight - 4;
     imageline($this->oImage, 0, $iLineHeight, $this->iWidth, $iLineHeight, $iBlack);
     imagestring($this->oImage, 2, 3, $this->iHeight - $iOwnerTextHeight - 3, $this->sOwnerText, $iBlack);
     $this->iHeight = $this->iHeight - $iOwnerTextHeight - 5;
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:9,代码来源:captcha.class.php


示例10: drawText

 public function drawText($sText, $iFont, $iColor, $iX, $iY)
 {
     $aText = explode("\n", $sText);
     $iLineHeight = imagefontheight($iFont);
     foreach ($aText as $sLine) {
         imagestring($this->rImage, $iFont, $iX, $iY, $sLine, $iColor);
         $iY += $iLineHeight;
     }
 }
开发者ID:fedyamaslov1987,项目名称:steamprofile,代码行数:9,代码来源:GDImage.class.php


示例11: StatTraqPieChart

 function StatTraqPieChart()
 {
     $this->StatGraph = new StatGraph();
     $this->useFade = true;
     //fill in chart parameters
     $this->chartTotal = 0;
     $this->chartDiameter = 300;
     $this->chartFont = 2;
     $this->chartFontHeight = imagefontheight($this->chartFont);
 }
开发者ID:prosenjit-itobuz,项目名称:upages,代码行数:10,代码来源:temp.grad.php


示例12: centeredtext

function centeredtext($image, $text, $font, $x1, $y1, $x2, $y2, $textcolor, $bgcolor, $bordercolor)
{
    imagerectangle($image, $x1, $y1, $x2, $y2, $bordercolor);
    imagerectangle($image, $x1 + 1, $y1 + 1, $x2 - 1, $y2 - 1, $bgcolor);
    $width = imagefontwidth($font) * strlen($text);
    $height = imagefontheight($font);
    $txtx = ($x2 - $x1 - $width) / 2 + $x1;
    $txty = ($y2 - $y1 - $height) / 2 + $y1;
    imagestring($image, $font, $txtx, $txty, $text, $textcolor);
}
开发者ID:Artea,项目名称:tc-travelrun,代码行数:10,代码来源:cigraph.php


示例13: outputtext

 private function outputtext()
 {
     for ($i = 0; $i < $this->codeNum; $i++) {
         $fontcolor = imagecolorallocate($this->image, rand(0, 128), rand(0, 128), rand(0, 128));
         $fontsize = rand(3, 5);
         $x = floor($this->width / $this->codeNum) * $i + 3;
         $y = rand(0, $this->height - imagefontheight($fontsize));
         imagechar($this->image, $fontsize, $x, $y, $this->checkcode[$i], $fontcolor);
     }
 }
开发者ID:JiaJia01,项目名称:homework_09,代码行数:10,代码来源:yzm1.php


示例14: outstring

 private function outstring()
 {
     for ($i = 0; $i < $this->num; $i++) {
         $color = imagecolorallocate($this->img, rand(0, 128), rand(0, 128), rand(0, 128));
         $fontsize = rand(3, 5);
         $x = 3 + $this->width / $this->num * $i;
         $y = rand(0, imagefontheight($fontsize) - 3);
         imagechar($this->img, $fontsize, $x, $y, $this->code[$i], $color);
     }
 }
开发者ID:Qsaka,项目名称:rumRaisin,代码行数:10,代码来源:getCaptcha.php


示例15: drawCode

 private function drawCode()
 {
     for ($i = 0; $i < $this->codeLen; $i++) {
         $color = imagecolorallocate($this->img, mt_rand(0, 128), mt_rand(0, 128), mt_rand(0, 128));
         $fontsize = mt_rand(5, 8);
         $x = 3 + $this->codeWidth / $this->codeLen * $i;
         $y = rand(2, imagefontheight($fontsize) - 10);
         imagechar($this->img, $fontsize, $x, $y, $this->code[$i], $color);
     }
     return;
 }
开发者ID:marche147,项目名称:nsc-website,代码行数:11,代码来源:verify_code.php


示例16: generateImage

 public function generateImage()
 {
     $this->securityCode = $this->simpleRandString($this->codeLength);
     $img_path = dirname(__FILE__) . "/../../web/uploads/";
     if (!is_writable($img_path) && !is_dir($img_path)) {
         $error = "The image path {$img_path} does not appear to be writable or the folder does not exist. Please verify your settings";
         throw new Exception($error);
     }
     $this->img = imagecreatefromjpeg($img_path . $this->imageFile);
     $img_size = getimagesize($img_path . $this->imageFile);
     foreach ($this->fontColor as $fcolor) {
         $color[] = imagecolorallocate($this->img, hexdec(substr($fcolor, 1, 2)), hexdec(substr($fcolor, 3, 2)), hexdec(substr($fcolor, 5, 2)));
     }
     $line = imagecolorallocate($this->img, 255, 255, 255);
     $line2 = imagecolorallocate($this->img, 200, 200, 200);
     $fw = imagefontwidth($this->fontSize) + 3;
     $fh = imagefontheight($this->fontSize);
     // create a new string with a blank space between each letter so it looks better
     $newstr = "";
     for ($i = 0; $i < strlen($this->securityCode); $i++) {
         $newstr .= $this->securityCode[$i] . " ";
     }
     // remove the trailing blank
     $newstr = trim($newstr);
     // center the string
     $x = ($img_size[0] - strlen($newstr) * $fw) / 2;
     $font[0] = '/usr/share/fonts/truetype/msttcorefonts/arial.ttf';
     $font[1] = '/usr/share/fonts/truetype/msttcorefonts/arial.ttf';
     $font[2] = '/usr/share/fonts/truetype/msttcorefonts/arial.ttf';
     // create random lines over text
     for ($i = 0; $i < 3; $i++) {
         $s_x = rand(40, 180);
         $s_y = rand(5, 35);
         $e_x = rand($s_x - 50, $s_x + 50);
         $e_y = rand(5, 35);
         $c = rand(0, count($color) - 1);
         imageline($this->img, $s_x, $s_y, $e_x, $e_y, $color[$c]);
     }
     // random bg ellipses
     imageellipse($this->img, $s_x, $s_y, $e_x, $e_y, $line);
     imageellipse($this->img, $e_x, $e_y, $s_x, $s_y, $line2);
     // output each character at a random height and standard horizontal spacing
     for ($i = 0; $i < strlen($newstr); $i++) {
         $hz = mt_rand(10, $img_size[1] - $fh - 5);
         // randomize rotation
         $rotate = rand(-35, 35);
         // randomize font size
         $this->fontSize = rand(14, 18);
         // radomize color
         $c = rand(0, count($color) - 1);
         // imagechar( $this->img, $this->fontSize, $x + ($fw*$i), $hz, $newstr[$i], $color);
         imagettftext($this->img, $this->fontSize, $rotate, $x + $fw * $i, $hz + 12, $color[0], $font[$c], $newstr[$i]);
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:54,代码来源:sfCaptcha.php


示例17: DrawText

 /**
  * Overloaded method for drawing special label
  *
  * @param ressource $im
  */
 protected function DrawText($im)
 {
     if ($this->textfont != 0 && $this->a1 != '') {
         $bar_color = is_null($this->color1) ? NULL : $this->color1->allocate($im);
         if (!is_null($bar_color)) {
             $xPosition = $this->positionX / 2 - strlen($this->a1) / 2 * imagefontwidth($this->textfont);
             $text_color = is_null($this->color1) ? NULL : $this->color1->allocate($im);
             imagestring($im, $this->textfont, $xPosition, $this->maxHeight, $this->a1, $text_color);
         }
         $this->lastY = $this->maxHeight + imagefontheight($this->textfont);
     }
 }
开发者ID:cbsistem,项目名称:bansos-dev,代码行数:17,代码来源:othercode.barcode.php


示例18: DrawCharacters

 function DrawCharacters()
 {
     // loop through and write out selected number of characters
     for ($i = 0; $i < strlen($this->sCode); $i++) {
         // select random font
         $iCurrentFont = rand(8, 9);
         // select random greyscale colour
         $iRandColour = rand(1, 2);
         $iTextColour = imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour);
         // write text to image
         imagestring($this->oImage, $iCurrentFont, $this->iSpacing / 3 + $i * $this->iSpacing, ($this->iHeight - imagefontheight($iCurrentFont)) / 2, $this->sCode[$i], $iTextColour);
     }
 }
开发者ID:BeingAlien,项目名称:pdf-services,代码行数:13,代码来源:security-image.inc.php


示例19: setFont

 function setFont($d)
 {
     $d = (int) $d;
     if ($d < 1) {
         $d = 1;
     }
     if ($d > 5) {
         $d = 5;
     }
     $this->_font = $d;
     $this->_fontw = imagefontwidth($d);
     $this->_fonth = imagefontheight($d);
 }
开发者ID:DoctorLai,项目名称:PHPLogoInterpreter,代码行数:13,代码来源:class.logo.php


示例20: generateImage

 public function generateImage($securityCode = NULL)
 {
     $context = sfContext::getInstance();
     $l = $context->getLogger();
     if ($context->getRequest()->getGetParameter('reload') || !$securityCode || sfConfig::get('app_sf_captchagd_force_new_captcha', false)) {
         $this->securityCode = $this->simpleRandString($this->codeLength, $this->chars);
     } else {
         $this->securityCode = $securityCode;
     }
     $context->getUser()->setAttribute('captcha', $this->securityCode);
     $this->img = imagecreatetruecolor($this->image_width, $this->image_height);
     $bc_color = $this->allocateColor($this->img, $this->background_color);
     $border_color = $this->allocateColor($this->img, $this->border_color);
     imagefill($this->img, 0, 0, $bc_color);
     imagerectangle($this->img, 0, 0, $this->image_width - 1, $this->image_height - 1, $border_color);
     foreach ($this->fontColor as $fcolor) {
         $color[] = $this->allocateColor($this->img, $fcolor);
     }
     $fw = imagefontwidth($this->fontSize) + $this->image_width / 30;
     $fh = imagefontheight($this->fontSize);
     // create a new string with a blank space between each letter so it looks better
     $newstr = "";
     for ($i = 0; $i < strlen($this->securityCode); $i++) {
         $newstr .= $this->securityCode[$i] . " ";
     }
     // remove the trailing blank
     $newstr = trim($newstr);
     // center the string
     $x = ($this->image_width * 0.95 - strlen($newstr) * $fw) / 2;
     // create random lines over text
     $stripe_size_max = $this->image_height / 3;
     for ($i = 0; $i < 15; $i++) {
         $x2 = rand(0, $this->image_width);
         $y2 = rand(0, $this->image_height);
         imageline($this->img, $x2, $y2, $x2 + rand(-$stripe_size_max, $stripe_size_max), $y2 + rand(-$stripe_size_max, $stripe_size_max), $color[rand(0, count($color) - 1)]);
     }
     // output each character at a random height and standard horizontal spacing
     for ($i = 0; $i < strlen($newstr); $i++) {
         $hz = $fh + ($this->image_height - $fh) / 2 + mt_rand(-$this->image_height / 10, $this->image_height / 10);
         // randomize rotation
         $rotate = rand(-25, 25);
         // randomize font size
         $newFontSize = $this->fontSize + $this->fontSize * (rand(0, 3) / 10);
         $a = imagettftext($this->img, $newFontSize, $rotate, $x + $fw * $i, $hz, $color[rand(0, count($color) - 1)], $this->fonts_dir . $this->fonts[rand(0, count($this->fonts) - 1)], $newstr[$i]);
     }
     $context->getResponse()->setContentType('image/gif');
     imagegif($this->img);
     imagedestroy($this->img);
     $context->getResponse()->send();
 }
开发者ID:vcgato29,项目名称:poff,代码行数:50,代码来源:sfCaptchaGD.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imagefontwidth函数代码示例发布时间:2022-05-15
下一篇:
PHP imageflip函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap