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

PHP imageloadfont函数代码示例

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

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



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

示例1: image_create

function image_create()
{
    header("Content-type: image/png");
    $string = $_GET['text'];
    $font = imageloadfont("font.gdf");
    $im = imagecreatefrompng("captsource.png");
    $color[0] = imagecolorallocate($im, 0, 0, 0);
    $color[1] = imagecolorallocate($im, 192, 192, 192);
    $color[2] = imagecolorallocate($im, 255, 255, 00);
    $color[3] = imagecolorallocate($im, 00, 128, 255);
    $A = rand(0, 9);
    //Диапазон для A
    $B = rand(0, 9);
    //Диапазон для B
    $answer = 0;
    if ($B > $A) {
        $tmp = $B;
        $B = $A;
        $A = $tmp;
    }
    imagestring($im, $font, 5, rand(0, 2), $A, $color[rand(0, 3)]);
    if (rand(0, 1)) {
        imagestring($im, $font, 25, rand(0, 4), '+', $color[2]);
        $answer = $A + $B;
    } else {
        imagestring($im, $font, 25, rand(0, 4), '-', $color[rand(0, 3)]);
        $answer = $A - $B;
    }
    imagestring($im, $font, 50, rand(0, 2), $B, $color[rand(0, 3)]);
    imagestring($im, $font, 78, 1, '=', $color[0]);
    imagepng($im);
    imagedestroy($im);
    $_SESSION['answer'] = $answer;
}
开发者ID:VladimirGuzenko,项目名称:SimpleCaptcha,代码行数:34,代码来源:capt.php


示例2: setFont

 public function setFont($fuente)
 {
     if (is_nan($fuente)) {
         $fuente = imageloadfont($fuente);
     }
     $this->fuente = $fuente;
 }
开发者ID:vallejos,项目名称:samples,代码行数:7,代码来源:titulo.php


示例3: generate

 private function generate()
 {
     $this->image = imagecreate($this->width, $this->height);
     imagecolorallocate($this->image, 200, 200, 200);
     $text_color = imagecolorallocate($this->image, 50, 50, 50);
     $this->jamm();
     $font = imageloadfont(Kennel::$ROOT_PATH . '/system/assets/files/dots.gdf');
     imagestring($this->image, $font, 5, 5, $this->text, $text_color);
 }
开发者ID:rev087,项目名称:kennel,代码行数:9,代码来源:Captcha.php


示例4: __construct

 function __construct($face, $color)
 {
     if (is_int($face) && $face >= 1 && $face <= 5) {
         $this->font = $face;
     } else {
         $this->font = imageloadfont($face);
     }
     $this->color = $color;
 }
开发者ID:baltruschat,项目名称:selectconnect,代码行数:9,代码来源:GDF.php


示例5: add_ticket

function add_ticket($var_filename, $number, $dest, $text, $fax_img = null)
{
    unset($exec_output);
    unset($exec_return);
    $convert_cmd = "/usr/bin/convert  {$var_filename} " . IMAGEN_FAX;
    if (file_exists($var_filename)) {
        exec($convert_cmd, $exec_output, $exec_return);
    }
    if (file_exists(IMAGEN_FAX)) {
        $files .= IMAGEN_FAX . " ";
        echo "entro 19";
        if (!function_exists('imagecreatefromjpeg')) {
            die("no existe");
        }
        $image = imagecreatefromjpeg(IMAGEN_FAX);
        $fuente1 = imageloadfont("arialns.gdf");
        $fuente2 = imageloadfont("arial.gdf");
        $fuente3 = imageloadfont("code.gdf");
        imagestring($image, $fuente1, 10, 10, " Al contestar por favor cite estos datos", $negro);
        imagestring($image, $fuente2, 10, 30, " Fecha de Radicado: " . date('d-m-Y') . "", $negro);
        imagestring($image, $fuente2, 10, 50, " No. de Radicado:20075000000491", $negro);
        imagestring($image, $fuente3, 10, 70, " 20075000000491", $negro);
        imagejpeg($image, IMAGEN_FAX, 100);
    } else {
        $i = 0;
        while (file_exists(IMAGEN_FAX . ".{$i}")) {
            $image = imagecreatefrompng(IMAGEN_FAX . ".{$i}");
            $negro = imagecolorallocate($image, 0, 0, 0);
            $x = imagesx($image);
            imagerectangle($image, $x / 2 - 5, 90, $x / 2 + 240, 170, $negro);
            imagestring($image, 5, $x / 2, 100, "SUPERSOLIDARIA Rad No. {$number}", $negro);
            imagestring($image, 5, $x / 2, 120, "{$text}", $negro);
            imagestring($image, 5, $x / 2, 140, "Gestion Documental Orfeo", $negro);
            imagepng($image, IMAGEN_FAX . ".{$i}");
            $files .= IMAGEN_FAX . ".{$i} ";
            $i++;
            imagedestroy($image);
        }
        echo "entro else fax_temp";
    }
    unset($exec_output);
    unset($exec_return);
    $convert = "/usr/bin/convert -adjoin {$files} {$dest}";
    exec($convert, $exec_output, $exec_return);
    echo $convert;
    if (file_exists(IMAGEN_FAX)) {
        exec("rm -rf " . IMAGEN_FAX);
    } else {
        $i = 0;
        while (file_exists(IMAGEN_FAX . ".{$i}")) {
            exec("rm -rf " . IMAGEN_FAX . ".{$i}");
            $i++;
        }
    }
}
开发者ID:johnfelipe,项目名称:orfeo,代码行数:55,代码来源:functions.php


示例6: createImage

 function createImage()
 {
     $rgb = explode(',', $this->textcolor);
     $im = imagecreatetruecolor($this->width, $this->height);
     $text_color = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
     $font = imageloadfont('./Army.ttf');
     imagestring($im, $font, 100, 105, $this->slidetext, $text_color);
     // Set the content type header - in this case image/jpeg
     header('Content-Type: image/jpeg');
     // Output the image
     imagejpeg($im, './slides/slide1.jpeg');
     // Free up memory
     imagedestroy($im);
 }
开发者ID:sknagesh,项目名称:divyaeng2,代码行数:14,代码来源:class.Slide.php


示例7: kleeja_cpatcha_image

function kleeja_cpatcha_image()
{
    //Let's generate a totally random string using md5
    $md5_hash = md5(rand(0, 999));
    //I think the bad things in captcha is two things, O and 0 , so let's remove zero.
    $security_code = str_replace('0', '', $md5_hash);
    //We don't need a 32 character long string so we trim it down to 5
    $security_code = substr($security_code, 15, 5);
    //Set the session to store the security code
    $_SESSION["klj_sec_code"] = $security_code;
    //Set the image width and height
    $width = 150;
    $height = 25;
    //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, rand(0, 100), 0, rand(0, 50));
    $grey = ImageColorAllocate($image, 204, 204, 204);
    //Make the background black
    ImageFill($image, 0, 0, $black);
    //options
    $x = 10;
    $y = 14;
    $angle = rand(-7, -10);
    //Add randomly generated string in white to the image
    if (function_exists('imagettftext')) {
        //
        // We figure a bug that happens when you add font name without './' before it ..
        // he search in the Linux fonts cache , but when you add './' he will know it's our font.
        //
        imagettftext($image, 16, $angle, rand(50, $x), $y + rand(1, 3), $white, './arial.ttf', $security_code);
    } else {
        imagestring($image, imageloadfont('arial.gdf'), $x + rand(10, 15), $y - rand(10, 15), $security_code, $white);
    }
    //kleeja !
    imagestring($image, 1, $width - 35, $height - 10, 'Kleeja', ImageColorAllocate($image, 200, 200, 200));
    //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/png");
    //Output the newly created image in jpeg format
    ImagePng($image);
    //Free up resources
    ImageDestroy($image);
}
开发者ID:kmkDesign,项目名称:phpquran,代码行数:48,代码来源:captcha.php


示例8: display

 function display()
 {
     $width = 26 * $this->size;
     $height = 50;
     $string = $this->randStr();
     $im = ImageCreate($width, $height);
     $imBG = imagecreatefromjpeg(dirname(__FILE__) . "/captcha/images/captcha.jpg");
     $bg = imagecolorallocate($im, 255, 255, 255);
     $black = imagecolorallocate($im, 0, 0, 0);
     $grey = imagecolorallocate($im, 170, 170, 170);
     imagerectangle($im, 0, 0, $width - 1, $height - 1, $grey);
     $font = imageloadfont(dirname(__FILE__) . "/captcha/font/anonymous.gdf");
     imagestring($im, $font, $this->size, 5, $string, $black);
     imagecopymerge($im, $imBG, 0, 0, 0, 0, 256, 256, 55);
     imagepng($im);
     imagedestroy($im);
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:17,代码来源:Captcha.php


示例9: __construct

 public function __construct($aWidth = 0, $aHeight = 0, $aFormat = DEFAULT_GFORMAT, $aSetAutoMargin = true)
 {
     $this->original_width = $aWidth;
     $this->original_height = $aHeight;
     $this->CreateImgCanvas($aWidth, $aHeight);
     if ($aSetAutoMargin) {
         $this->SetAutoMargin();
     }
     if (!$this->SetImgFormat($aFormat)) {
         Util\JpGraphError::RaiseL(25081, $aFormat);
         //("JpGraph: Selected graphic format is either not supported or unknown [$aFormat]");
     }
     $this->ttf = new TTF();
     $this->langconv = new LanguageConv();
     $this->ff_font0 = imageloadfont(dirname(dirname(__FILE__)) . "/fonts/FF_FONT0.gdf");
     $this->ff_font1 = imageloadfont(dirname(dirname(__FILE__)) . "/fonts/FF_FONT1.gdf");
     $this->ff_font2 = imageloadfont(dirname(dirname(__FILE__)) . "/fonts/FF_FONT2.gdf");
     $this->ff_font1_bold = imageloadfont(dirname(dirname(__FILE__)) . "/fonts/FF_FONT1-Bold.gdf");
     $this->ff_font2_bold = imageloadfont(dirname(dirname(__FILE__)) . "/fonts/FF_FONT2-Bold.gdf");
 }
开发者ID:amenadiel,项目名称:jpgraph,代码行数:20,代码来源:Image.php


示例10: show

 public function show()
 {
     Response::getInstance()->setContent('image/png');
     $str = $this->randomString();
     Session::getInstance()->Captcha = $str;
     $image_x = 100;
     $image_y = 40;
     $im = imagecreatetruecolor($image_x, $image_y);
     $bgcoolor = imagecolorallocate($im, rand(177, 255), rand(177, 255), rand(177, 255));
     imagefill($im, 0, 0, $bgcoolor);
     $cl = imagecolorallocate($im, rand(0, 100), rand(0, 100), rand(0, 100));
     $f = imageloadfont('hadi.gdf');
     imagestring($im, $f, 10, 10, $str, $cl);
     $lineCount = rand(7, 12);
     while ($lineCount--) {
         $cl = imagecolorallocate($im, rand(0, 127), rand(0, 127), rand(0, 127));
         imageline($im, rand(0, $image_x), rand(0, $image_y), rand(0, $image_x), rand(0, $image_y), $cl);
     }
     imagepng($im);
 }
开发者ID:redknight,项目名称:frot,代码行数:20,代码来源:CaptchaService.php


示例11: createImage

 function createImage($width = 135, $height = 45)
 {
     // send header for our image
     header("Content-type:image/jpeg");
     // create an image
     $im = imagecreate($width, $height);
     // white background
     $black = imagecolorallocate($im, 0, 0, 0);
     // black text and grid
     $white = imagecolorallocate($im, 255, 255, 255);
     $other = imagecolorallocate($im, 0, 0, 255);
     // get a random number to start drawing out grid from
     $num = rand(0, 5);
     // draw vertical bars
     for ($i = $num; $i <= $width; $i += 10) {
         imageline($im, $i, 0, $i, 45, $other);
     }
     // draw horizontal bars
     for ($i = $num; $i <= $height + 10; $i += 10) {
         imageline($im, 0, $i, 135, $i, $other);
     }
     // generate a random string
     $string = substr(strtolower(md5(uniqid(rand(), 1))), 0, 7);
     $string = str_replace('2', 'a', $string);
     $string = str_replace('l', 'p', $string);
     $string = str_replace('1', 'h', $string);
     $string = str_replace('0', 'y', $string);
     $string = str_replace('o', 'y', $string);
     // place this string into the image
     $font = imageloadfont('anticlimax.gdf');
     imagestring($im, $font, 10, 10, $string, $white);
     // create the image and send to browser
     imagejpeg($im);
     // destroy the image
     imagedestroy($im);
     // return the random text generated
     return $this->text = $string;
 }
开发者ID:neofutur,项目名称:MyBestBB,代码行数:38,代码来源:ran.class.php


示例12: abatly_captcha

function abatly_captcha()
{
    $md5_hash = md5(rand(0, 999));
    $security_code = str_replace('0', '', $md5_hash);
    $security_code = substr($security_code, 15, 5);
    $_SESSION["security_code"] = $security_code;
    $width = 128;
    $height = 40;
    $image = ImageCreate($width, $height);
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, rand(0, 100), 0, rand(0, 50));
    $grey = ImageColorAllocate($image, 204, 204, 204);
    $red = imagecolorallocatealpha($image, 255, 0, 0, 75);
    $green = imagecolorallocatealpha($image, 0, 255, 0, 75);
    $blue = imagecolorallocatealpha($image, 0, 0, 255, 75);
    imagefilledrectangle($image, 0, 0, $width, $height, $white);
    imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $red);
    imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $green);
    imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $blue);
    imagefilledrectangle($image, 0, 0, $width, 0, $black);
    imagefilledrectangle($image, $width - 1, 0, $width - 1, $height - 1, $black);
    imagefilledrectangle($image, 0, 0, 0, $height - 1, $black);
    imagefilledrectangle($image, 0, $height - 1, $width, $height - 1, $black);
    ImageFill($image, 0, 0, $black);
    $x = 20;
    $y = 24;
    $angle = rand(-7, -10);
    if (function_exists('imagettftext')) {
        imagettftext($image, 20, $angle, rand(20, $x), $y + rand(1, 3), $black, 'arial.ttf', $security_code);
    } else {
        imagestring($image, imageloadfont('arial.gdf'), $x + rand(10, 15), $y - rand(10, 15), $security_code, $white);
    }
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $black);
    imageline($image, $width / 2, 0, $width / 2, $height, $black);
    header("Content-Type: image/png");
    ImagePng($image);
    ImageDestroy($image);
}
开发者ID:bunnywong,项目名称:freshlinker,代码行数:38,代码来源:create_image.php


示例13: imgtxt_mk

function imgtxt_mk($t, $fx, $fy, $lac, $hac, $fnt, $clr, $dest)
{
    $t = str_replace("&nbsp;", ' ', $t);
    $nb_chars = strlen($t);
    $width = 400;
    //currentwidth();
    if ($lac && $width) {
        $maxl = floor($width / $lac);
    } else {
        $maxl = 400;
    }
    $la = $nb_chars * $lac;
    $la = $la > $width - 8 ? $width - 8 : $la;
    if ($nb_chars > $maxl or strpos($t, "\n") !== false) {
        $r = gdf_nblines($t, $maxl);
    }
    //$r=imt_mk($t);
    $ha = $r ? $hac * count($r) : ($hac ? $hac : 20);
    $clr = $clr ? $clr : '000000';
    $rh = hexdec(substr($clr, 0, 2));
    $gh = hexdec(substr($clr, 2, 2));
    $bh = hexdec(substr($clr, 4, 2));
    $image = imagecreate($la, $ha);
    $blanc = imagecolorallocate($image, 255, 255, 255);
    $color = imagecolorallocate($image, $rh, $gh, $bh);
    $font = imageloadfont($fnt);
    if ($r) {
        foreach ($r as $k => $v) {
            $fx = $k * lac;
            $fy = $k * $hac;
            imagestring($image, $font, 1, $fy, $v, $color);
        }
    } else {
        imagestring($image, $font, $fx ? $fx : 0, $fy ? $fy : 0, $t, $color);
    }
    imagecolortransparent($image, $blanc);
    imagepng($image, $dest);
}
开发者ID:philum,项目名称:cms,代码行数:38,代码来源:imgtxt.php


示例14: generateValidationImage

 function generateValidationImage($rand)
 {
     global $site_font_path;
     global $site_font_validation;
     $width = 120;
     $height = 40;
     $image = imagecreate($width, $height);
     $bgColor = imagecolorallocate($image, 255, 255, 255);
     $textColor = imagecolorallocate($image, 0, 0, 0);
     // Add Random noise
     for ($i = 0; $i < 250; $i++) {
         $rx1 = rand(0, $width);
         $rx2 = rand(0, $width);
         $ry1 = rand(0, $height);
         $ry2 = rand(0, $height);
         $rcVal = rand(0, 255);
         $rc1 = imagecolorallocate($image, rand(0, 255), rand(0, 255), rand(100, 255));
         imageline($image, $rx1, $ry1, $rx2, $ry2, $rc1);
     }
     // write the random number
     $font = imageloadfont($site_font_path . "/" . $site_font_validation);
     imagestring($image, $font, 3, 0, $rand, $textColor);
     // send several headers to make sure the image is not cached
     // Date in the past
     header("Expires: Mon, 23 Jul 1993 05:00:00 GMT");
     // always modified
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // HTTP/1.1
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     // HTTP/1.0
     header("Pragma: no-cache");
     // send the content type header so the image is displayed properly
     header('Content-type: image/jpeg');
     imagejpeg($image);
     imagedestroy($image);
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:37,代码来源:graphics.php


示例15: process


//.........这里部分代码省略.........
                                 if (strpos($this->image_watermark_position, 't') !== false) {
                                     $watermark_y = 0;
                                 } else {
                                     $watermark_y = ($this->image_dst_y - $watermark_height) / 2;
                                 }
                             }
                         }
                         imagecopyresampled($image_dst, $filter, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);
                     } else {
                         $this->error = _("Watermark image is of unknown type");
                     }
                 }
                 // add text
                 if (!empty($this->image_text)) {
                     $this->log .= '- ' . _("add text") . '<br />';
                     if (!is_numeric($this->image_text_padding)) {
                         $this->image_text_padding = 0;
                     }
                     if (!is_numeric($this->image_text_line_spacing)) {
                         $this->image_text_line_spacing = 0;
                     }
                     if (!is_numeric($this->image_text_padding_x)) {
                         $this->image_text_padding_x = $this->image_text_padding;
                     }
                     if (!is_numeric($this->image_text_padding_y)) {
                         $this->image_text_padding_y = $this->image_text_padding;
                     }
                     $this->image_text_position = strtolower($this->image_text_position);
                     $this->image_text_direction = strtolower($this->image_text_direction);
                     $this->image_text_alignment = strtolower($this->image_text_alignment);
                     // if the font is a string, we assume that we might want to load a font
                     if (!is_numeric($this->image_text_font) && strlen($this->image_text_font) > 4 && substr(strtolower($this->image_text_font), -4) == '.gdf') {
                         $this->log .= '&nbsp;&nbsp;&nbsp;&nbsp;' . _("try to load font") . ' ' . $this->image_text_font . '... ';
                         if ($this->image_text_font = @imageloadfont($this->image_text_font)) {
                             $this->log .= _("success") . '<br />';
                         } else {
                             $this->log .= _("error") . '<br />';
                             $this->image_text_font = 5;
                         }
                     }
                     $text = explode("\n", $this->image_text);
                     $char_width = ImageFontWidth($this->image_text_font);
                     $char_height = ImageFontHeight($this->image_text_font);
                     $text_height = 0;
                     $text_width = 0;
                     $line_height = 0;
                     $line_width = 0;
                     foreach ($text as $k => $v) {
                         if ($this->image_text_direction == 'v') {
                             $h = $char_width * strlen($v);
                             if ($h > $text_height) {
                                 $text_height = $h;
                             }
                             $line_width = $char_height;
                             $text_width += $line_width + ($k < sizeof($text) - 1 ? $this->image_text_line_spacing : 0);
                         } else {
                             $w = $char_width * strlen($v);
                             if ($w > $text_width) {
                                 $text_width = $w;
                             }
                             $line_height = $char_height;
                             $text_height += $line_height + ($k < sizeof($text) - 1 ? $this->image_text_line_spacing : 0);
                         }
                     }
                     $text_width += 2 * $this->image_text_padding_x;
                     $text_height += 2 * $this->image_text_padding_y;
开发者ID:tieulonglanh,项目名称:leminhhoan-01,代码行数:67,代码来源:upload1.php


示例16: drawWord

 /**
  * Draw the CAPTCHA code over the image
  *
  * @access private
  *
  */
 function drawWord()
 {
     if ($this->use_gd_font == true) {
         if (!is_int($this->gd_font_file)) {
             //is a file name
             $font = @imageloadfont($this->gd_font_file);
             if ($font == false) {
                 trigger_error("Failed to load GD Font file {$this->gd_font_file} ", E_USER_WARNING);
                 return;
             }
         } else {
             //gd font identifier
             $font = $this->gd_font_file;
         }
         $color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)));
         imagestring($this->im, $font, $this->text_x_start, $this->image_height / 2 - $this->gd_font_size / 2, $this->code, $color);
     } else {
         //ttf font
         if ($this->use_transparent_text == true) {
             $alpha = intval($this->text_transparency_percentage / 100 * 127);
             $font_color = imagecolorallocatealpha($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)), $alpha);
         } else {
             //no transparency
             $font_color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)));
         }
         $x = $this->text_x_start;
         $strlen = strlen($this->code);
         $y_min = $this->image_height / 2 + $this->font_size / 2 - 2;
         $y_max = $this->image_height / 2 + $this->font_size / 2 + 2;
         $colors = explode(',', $this->multi_text_color);
         for ($i = 0; $i < $strlen; ++$i) {
             $angle = rand($this->text_angle_minimum, $this->text_angle_maximum);
             $y = rand($y_min, $y_max);
             if ($this->use_multi_text == true) {
                 $idx = rand(0, sizeof($colors) - 1);
                 $r = substr($colors[$idx], 1, 2);
                 $g = substr($colors[$idx], 3, 2);
                 $b = substr($colors[$idx], 5, 2);
                 if ($this->use_transparent_text == true) {
                     $font_color = imagecolorallocatealpha($this->im, "0x{$r}", "0x{$g}", "0x{$b}", $alpha);
                 } else {
                     $font_color = imagecolorallocate($this->im, "0x{$r}", "0x{$g}", "0x{$b}");
                 }
             }
             @imagettftext($this->im, $this->font_size, $angle, $x, $y, $font_color, $this->ttf_file, $this->code[$i]);
             $x += rand($this->text_minimum_distance, $this->text_maximum_distance);
         }
         //for loop
     }
     //else ttf font
 }
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:57,代码来源:securimage.php


示例17: drawWord

 /**
  * Draw the CAPTCHA code over the image
  *
  * @access private
  *
  */
 function drawWord()
 {
     if ($this->use_gd_font == true) {
         if (!is_int($this->gd_font_file)) {
             //is a file name
             $font = @imageloadfont($this->gd_font_file);
             if ($font == false) {
                 trigger_error("Failed to load GD Font file {$this->gd_font_file} ", E_USER_WARNING);
                 return;
             }
         } else {
             //gd font identifier
             $font = $this->gd_font_file;
         }
         $color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)));
         imagestring($this->im, $font, $this->text_x_start, $this->image_height / 2 - $this->gd_font_size / 2, $this->code, $color);
     } else {
         //ttf font
         if ($this->use_transparent_text == true) {
             $alpha = intval($this->text_transparency_percentage / 100 * 127);
             $font_color = imagecolorallocatealpha($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)), $alpha);
         } else {
             //no transparency
             $font_color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)));
         }
         $x = $this->text_x_start;
         $strlen = strlen($this->code);
         $y_min = $this->image_height / 2 + $this->font_size / 2 - 2;
         $y_max = $this->image_height / 2 + $this->font_size / 2 + 2;
         $colors = explode(',', $this->multi_text_color);
         for ($i = 0; $i < $strlen; ++$i) {
             $angle = rand($this->text_angle_minimum, $this->text_angle_maximum);
             $y = rand($y_min, $y_max);
             if ($this->use_multi_text == true) {
                 $idx = rand(0, sizeof($colors) - 1);
                 $r = substr($colors[$idx], 1, 2);
                 $g = substr($colors[$idx], 3, 2);
                 $b = substr($colors[$idx], 5, 2);
                 if ($this->use_transparent_text == true) {
                     $font_color = imagecolorallocatealpha($this->im, "0x{$r}", "0x{$g}", "0x{$b}", $alpha);
                 } else {
                     $font_color = imagecolorallocate($this->im, "0x{$r}", "0x{$g}", "0x{$b}");
                 }
             }
             /* Will check if the FreeType library is loaded, if not, use the default PHP fonts.
              * @customized by ATutor, Harris Wong
              */
             if (function_exists('imagettftext')) {
                 @imagettftext($this->im, $this->font_size, $angle, $x, $y, $font_color, $this->ttf_file, $this->code[$i]);
             } else {
                 $this->arc_linethrough = false;
                 //no arcline then,too hard to see with the built in fonts and limited size
                 imagestring($this->im, 5, $x, $y - 15, $this->code[$i], $font_color);
             }
             $x += rand($this->text_minimum_distance, $this->text_maximum_distance);
         }
         //for loop
     }
     //else ttf font
 }
开发者ID:giuliaforsythe,项目名称:AChecker,代码行数:66,代码来源:securimage.php


示例18: showCodeImage

function showCodeImage($code)
{
    global $settings, $user_info, $modSettings;
    /*
    	Note: The higher the value of visual_verification_type the harder the verification is - from 0 as disabled through to 4 as "Very hard".
    */
    // What type are we going to be doing?
    $imageType = $modSettings['visual_verification_type'];
    // Special case to allow the admin center to show samples.
    if ($user_info['is_admin'] && isset($_GET['type'])) {
        $imageType = (int) $_GET['type'];
    }
    // Some quick references for what we do.
    // Do we show no, low or high noise?
    $noiseType = $imageType == 3 ? 'low' : ($imageType == 4 ? 'high' : ($imageType == 5 ? 'extreme' : 'none'));
    // Can we have more than one font in use?
    $varyFonts = $imageType > 3 ? true : false;
    // Just a plain white background?
    $simpleBGColor = $imageType < 3 ? true : false;
    // Plain black foreground?
    $simpleFGColor = $imageType == 0 ? true : false;
    // High much to rotate each character.
    $rotationType = $imageType == 1 ? 'none' : ($imageType > 3 ? 'low' : 'high');
    // Do we show some characters inversed?
    $showReverseChars = $imageType > 3 ? true : false;
    // Special case for not showing any characters.
    $disableChars = $imageType == 0 ? true : false;
    // What do we do with the font colors. Are they one color, close to one color or random?
    $fontColorType = $imageType == 1 ? 'plain' : ($imageType > 3 ? 'random' : 'cyclic');
    // Are the fonts random sizes?
    $fontSizeRandom = $imageType > 3 ? true : false;
    // How much space between characters?
    $fontHorSpace = $imageType > 3 ? 'high' : ($imageType == 1 ? 'medium' : 'minus');
    // Where do characters sit on the image? (Fixed position or random/very random)
    $fontVerPos = $imageType == 1 ? 'fixed' : ($imageType > 3 ? 'vrandom' : 'random');
    // Make font semi-transparent?
    $fontTrans = $imageType == 2 || $imageType == 3 ? true : false;
    // Give the image a border?
    $hasBorder = $simpleBGColor;
    // Is this GD2? Needed for pixel size.
    $testGD = get_extension_funcs('gd');
    $gd2 = in_array('imagecreatetruecolor', $testGD) && function_exists('imagecreatetruecolor');
    unset($testGD);
    // The amount of pixels inbetween characters.
    $character_spacing = 1;
    // What color is the background - generally white unless we're on "hard".
    if ($simpleBGColor) {
        $background_color = array(255, 255, 255);
    } else {
        $background_color = isset($settings['verification_background']) ? $settings['verification_background'] : array(236, 237, 243);
    }
    // The color of the characters shown (red, green, blue).
    if ($simpleFGColor) {
        $foreground_color = array(0, 0, 0);
    } else {
        $foreground_color = array(64, 101, 136);
        // Has the theme author requested a custom color?
        if (isset($settings['verification_foreground'])) {
            $foreground_color = $settings['verification_foreground'];
        }
    }
    if (!is_dir($settings['default_theme_dir'] . '/fonts')) {
        return false;
    }
    // Get a list of the available fonts.
    $font_dir = dir($settings['default_theme_dir'] . '/fonts');
    $font_list = array();
    $ttfont_list = array();
    while ($entry = $font_dir->read()) {
        if (preg_match('~^(.+)\\.gdf$~', $entry, $matches) === 1) {
            $font_list[] = $entry;
        } elseif (preg_match('~^(.+)\\.ttf$~', $entry, $matches) === 1) {
            $ttfont_list[] = $entry;
        }
    }
    if (empty($font_list)) {
        return false;
    }
    // For non-hard things don't even change fonts.
    if (!$varyFonts) {
        $font_list = array($font_list[0]);
        // Try use Screenge if we can - it looks good!
        if (in_array('Screenge.ttf', $ttfont_list)) {
            $ttfont_list = array('Screenge.ttf');
        } else {
            $ttfont_list = empty($ttfont_list) ? array() : array($ttfont_list[0]);
        }
    }
    // Create a list of characters to be shown.
    $characters = array();
    $loaded_fonts = array();
    for ($i = 0; $i < strlen($code); $i++) {
        $characters[$i] = array('id' => $code[$i], 'font' => array_rand($font_list));
        $loaded_fonts[$characters[$i]['font']] = null;
    }
    // Load all fonts and determine the maximum font height.
    foreach ($loaded_fonts as $font_index => $dummy) {
        $loaded_fonts[$font_index] = imageloadfont($settings['default_theme_dir'] . '/fonts/' . $font_list[$font_index]);
    }
    // Determine the dimensions of each character.
//.........这里部分代码省略.........
开发者ID:valek0972,项目名称:hackits,代码行数:101,代码来源:Subs-Graphics.php


示例19: marktpreise

function marktpreise()
{
    // berechnet die marktpreise neu
    $select = "SELECT SUM( eisenmine ) AS ges FROM `gebauede`;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $eisen_gw = ($row['ges'] * 30 / 100 * ($row['ges'] * 5) + (40 + $row['ges'] * 30)) * 2;
    $select = "SELECT SUM( titanmine ) AS ges FROM `gebauede`;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $titan_gw = ($row['ges'] * 20 / 100 * ($row['ges'] * 5) + (20 + $row['ges'] * 20)) * 2;
    $select = "SELECT SUM( oelpumpe ) AS ges FROM `gebauede`;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $oel_gw = ($row['ges'] * 25 / 100 * ($row['ges'] * 5) + (32 + $row['ges'] * 25)) * 2;
    $select = "SELECT SUM( uranmine ) AS ges FROM `gebauede`;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $uran_gw = ($row['ges'] * 12 / 100 * ($row['ges'] * 5) + $row['ges'] * 12) * 2;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '0' AND `einheit` = '1' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $ges['eisen'] = $row['ges'] + $eisen_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '0' AND `einheit` = '2' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $ges['titan'] = $row['ges'] + $titan_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '0' AND `einheit` = '3' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $ges['oel'] = $row['ges'] + $oel_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '0' AND `einheit` = '4' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $ges['uran'] = $row['ges'] + $uran_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '1' AND `einheit` = '1' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $mges['eisen'] = $row['ges'] + $eisen_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '1' AND `einheit` = '2' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $mges['titan'] = $row['ges'] + $titan_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '1' AND `einheit` = '3' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $mges['oel'] = $row['ges'] + $oel_gw;
    $select = "SELECT einheit, SUM(menge) as ges FROM `markt` WHERE `type` = '1' AND `einheit` = '4' GROUP BY einheit;";
    $result = mysql_query($select);
    $row = mysql_fetch_array($result);
    $mges['uran'] = $row['ges'] + $uran_gw;
    $ek['eisen'] = number_format(300 / 100 * $ges['eisen'] / (($ges['eisen'] + $mges['eisen']) / 100), 2);
    $vk['eisen'] = number_format(300 / 100 * $ges['eisen'] / (($ges['eisen'] + $mges['eisen']) / 100) / 2, 2);
    $ek['titan'] = number_format(400 / 100 * $ges['titan'] / (($ges['titan'] + $mges['titan']) / 100), 2);
    $vk['titan'] = number_format(400 / 100 * $ges['titan'] / (($ges['titan'] + $mges['titan']) / 100) / 2, 2);
    $ek['oel'] = number_format(350 / 100 * $ges['oel'] / (($ges['oel'] + $mges['oel']) / 100), 2);
    $vk['oel'] = number_format(350 / 100 * $ges['oel'] / (($ges['oel'] + $mges['oel']) / 100) / 2, 2);
    $ek['uran'] = number_format(500 / 100 * $ges['uran'] / (($ges['uran'] + $mges['uran']) / 100), 2);
    $vk['uran'] = number_format(500 / 100 * $ges['uran'] / (($ges['uran'] + $mges['uran']) / 100) / 2, 2);
    mysql_query("INSERT INTO `marktpreise` ( `id` , `time` , `ek_eisen` , `ek_oel` , `ek_titan` , `ek_uran` , `vk_eisen` , `vk_oel` , `vk_titan` , `vk_uran` ) VALUES ( '', '" . date('U') . "', '" . $ek['eisen'] . "', '" . $ek['oel'] . "', '" . $ek['titan'] . "', '" . $ek['uran'] . "', '" . $vk['eisen'] . "', '" . $vk['oel'] . "', '" . $vk['titan'] . "', '" . $vk['uran'] . "' );");
    $bild1 = imagecreatefromgif("img/graph.gif");
    $bild2 = imagecreatefromgif("img/graph.gif");
    $bild3 = imagecreatefromgif("img/graph.gif");
    $bild4 = imagecreatefromgif("img/graph.gif");
    $farbe = imagecolorallocate($bild1, 0, 0, 0);
    $font = imageloadfont('code/addlg10.gdf');
    imagestring($bild1, 10, 30, 230, 'Preisentwicklung Eisen ' . date('(d.m.Y - H:i)'), $farbe);
    imagestring($bild2, 10, 30, 230, 'Preisentwicklung Titan ' . date('(d.m.Y - H:i)'), $farbe);
    imagestring($bild3, 10, 40, 230, 'Preisentwicklung Oel ' . date('(d.m.Y - H:i)'), $farbe);
    imagestring($bild4, 10, 35, 230, 'Preisentwicklung Uran ' . date('(d.m.Y - H:i)'), $farbe);
    $result = mysql_query("SELECT * FROM `marktpreise` GROUP BY `id` DESC LIMIT 0,42;");
    do {
        $i++;
        $row = mysql_fetch_array($result);
        $y1 = number_format($row['ek_eisen'] / 2, 0, '', '');
        $y2 = number_format($row['ek_titan'] / 2, 0, '', '');
        $y3 = number_format($row['ek_oel'] / 2, 0, '', '');
        $y4 = number_format($row['ek_uran'] / 2, 0, '', '');
        if ($oldy1 != '') {
            imageline($bild1, 420 - $i * 10, 210 - $y1, 420 - ($i - 1) * 10, 210 - $oldy1, $farbe);
            imageline($bild2, 420 - $i * 10, 210 - $y2, 420 - ($i - 1) * 10, 210 - $oldy2, $farbe);
            imageline($bild3, 420 - $i * 10, 210 - $y3, 420 - ($i - 1) * 10, 210 - $oldy3, $farbe);
            imageline($bild4, 420 - $i * 10, 210 - $y4, 420 - ($i - 1) * 10, 210 - $oldy4, $farbe);
        }
        $oldy1 = $y1;
        $oldy2 = $y2;
        $oldy3 = $y3;
        $oldy4 = $y4;
    } while ($row and $i < 41);
    imagepng($bild1, 'eisenstats.png');
    imagepng($bild2, 'titanstats.png');
    imagepng($bild3, 'oelstats.png');
    imagepng($bild4, 'uranstats.png');
}
开发者ID:o-wars,项目名称:o-wars,代码行数:94,代码来源:eventhandler.php


示例20: array


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imagepolygon函数代码示例发布时间:2022-05-15
下一篇:
PHP imagelayereffect函数代码示例发布时间: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