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


PHP imageloadfont函数代码示例

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


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


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