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


PHP imagePng函数代码示例

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


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

示例1: save

 /**
  * 生成された画像を保存する
  *
  * @return boolean
  * @access public
  * @static
  */
 function save()
 {
     //保存先のディレクトリが存在しているかチェック
     $filePath = dirname($this->dstPath);
     if (!file_exists($filePath)) {
         mkdir($filePath);
     }
     if ($this->imageType == 'image/jpeg') {
         return imageJpeg($this->dstImage, $this->dstPath, $this->quality);
     } elseif ($this->imageType == 'image/gif') {
         return imageGif($this->dstImage, $this->dstPath);
     } elseif ($this->imageType == 'image/png') {
         return imagePng($this->dstImage, $this->dstPath);
     }
 }
开发者ID:hamhei,项目名称:onatter,代码行数:22,代码来源:thumbmake.php

示例2: image_createThumb

function image_createThumb($src, $dest, $maxWidth, $maxHeight, $quality = 75)
{
    if (file_exists($src) && isset($dest)) {
        // path info
        $destInfo = pathInfo($dest);
        // image src size
        $srcSize = getImageSize($src);
        // image dest size $destSize[0] = width, $destSize[1] = height
        $srcRatio = $srcSize[0] / $srcSize[1];
        // width/height ratio
        $destRatio = $maxWidth / $maxHeight;
        if ($destRatio > $srcRatio) {
            $destSize[1] = $maxHeight;
            $destSize[0] = $maxHeight * $srcRatio;
        } else {
            $destSize[0] = $maxWidth;
            $destSize[1] = $maxWidth / $srcRatio;
        }
        // path rectification
        if ($destInfo['extension'] == "gif") {
            $dest = substr_replace($dest, 'jpg', -3);
        }
        // true color image, with anti-aliasing
        $destImage = imageCreateTrueColor($destSize[0], $destSize[1]);
        //       imageAntiAlias($destImage,true);
        // src image
        switch ($srcSize[2]) {
            case 1:
                //GIF
                $srcImage = imageCreateFromGif($src);
                break;
            case 2:
                //JPEG
                $srcImage = imageCreateFromJpeg($src);
                break;
            case 3:
                //PNG
                $srcImage = imageCreateFromPng($src);
                break;
            default:
                return false;
                break;
        }
        // resampling
        imageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destSize[0], $destSize[1], $srcSize[0], $srcSize[1]);
        // generating image
        switch ($srcSize[2]) {
            case 1:
            case 2:
                imageJpeg($destImage, $dest, $quality);
                break;
            case 3:
                imagePng($destImage, $dest);
                break;
        }
        return true;
    } else {
        return 'No such File';
    }
}
开发者ID:rolfvandervleuten,项目名称:DeepskyLog,代码行数:60,代码来源:resize.php

示例3: king_def

function king_def()
{
    global $king;
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // 过去的时间
    header("Content-type: image/png");
    $salt = kc_get('salt', 1, 1);
    $width = $king->config('verifywidth');
    //图片长度
    $height = $king->config('verifyheight');
    //图片高度
    $size = $king->config('verifysize');
    //文字大小
    $num = $king->config('verifynum');
    //文字数量
    $content = $king->config('verifycontent');
    //随机字符
    $array_content = explode('|', $content);
    $array_content = array_diff($array_content, array(null));
    $array_font = kc_f_getdir('system/verify_font', 'ttf|ttc');
    $str = '';
    $img = imageCreate($width, $height);
    //创建一个空白图像
    imageFilledRectangle($img, 0, 0, $width, $height, imagecolorallocate($img, 255, 255, 255));
    //写字
    for ($i = 0; $i < $num; $i++) {
        $code = $array_content[array_rand($array_content)];
        $str .= $code;
        //验证码字符
        $color = imageColorAllocate($img, rand(0, 128), rand(0, 128), rand(0, 128));
        $font = 'verify_font/' . $array_font[array_rand($array_font)];
        //随机读取一个字体
        $left = rand(round($size * 0.2), round($size * 0.4)) + $i * $size;
        imagettftext($img, rand(round($size * 0.7), $size), rand(-20, 20), $left, rand(round($size * 1.2), $size * 1.4), $color, $font, $code);
    }
    //画星号
    $max = $width * $height / 400;
    for ($i = 0; $i < $max; $i++) {
        imagestring($img, 15, rand(0, $width), rand(0, $height), '*', rand(192, 250));
    }
    //画点
    $max = $width * $height / 40;
    for ($i = 0; $i < $max; $i++) {
        imageSetPixel($img, rand(0, $width), rand(0, $height), rand(1, 200));
    }
    //画线
    $max = $width * $height / 800;
    for ($i = 0; $i < $max; $i++) {
        imageline($img, rand(0, $width), rand(0, $height), rand(0, $width), rand(0, $height), rand(0, 255));
    }
    //写验证码到verify中
    $verify = new KC_Verify_class();
    $verify->Put($salt, $str);
    imagePng($img);
    imageDestroy($img);
    $verify->Clear();
}
开发者ID:jonycookie,项目名称:projectm2,代码行数:59,代码来源:verify.php

示例4: CreatePngThumbnail

 public static function CreatePngThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $imageNewName)
 {
     $srcImg = ImageCreateFromPng($imageDirectory . $imageName);
     $origWidth = imagesx($srcImg);
     $origHeight = imagesy($srcImg);
     $ratio = $thumbWidth / $origWidth;
     $thumbHeight = $origHeight * $ratio;
     $thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight);
     imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($srcImg), imagesy($srcImg));
     imagePng($thumbImg, $thumbDirectory . $imageNewName);
 }
开发者ID:brandfeverinc,项目名称:coke-cooler,代码行数:11,代码来源:Helpers.php

示例5: saveFile

 public static function saveFile($image = null, $destFile = null, $saveType = self::SAVE_JPG)
 {
     switch ($saveType) {
         case self::SAVE_GIF:
             return @imageGif($image, $destFile);
         case self::SAVE_JPG:
             return @imageJpeg($image, $destFile, self::SAVE_QUALITY);
         case self::SAVE_PNG:
             return @imagePng($image, $destFile);
         default:
             return false;
     }
 }
开发者ID:yunsite,项目名称:hhzuitu,代码行数:13,代码来源:Image.class.php

示例6: make_img

function make_img($content)
{
    $timage = array(strlen($content) * 20 + 10, 28);
    // array(largeur, hauteur) de l'image; ici la largeur est fonction du nombre de lettre du contenu, on peut bien sur mettre une largeur fixe.
    $content = preg_replace('/(\\w)/', '\\1 ', $content);
    // laisse plus d'espace entre les lettres
    $image = imagecreatetruecolor($timage[0], $timage[1]);
    // création de l'image
    // definition des couleurs
    $fond = imageColorAllocate($image, 240, 255, 240);
    $grey = imageColorAllocate($image, 210, 210, 210);
    $text_color = imageColorAllocate($image, rand(0, 100), rand(0, 50), rand(0, 60));
    imageFill($image, 0, 0, $fond);
    // on remplit l'image de blanc
    //On remplit l'image avec des polygones
    for ($i = 0, $imax = mt_rand(3, 5); $i < $imax; $i++) {
        $x = mt_rand(3, 10);
        $poly = array();
        for ($j = 0; $j < $x; $j++) {
            $poly[] = mt_rand(0, $timage[0]);
            $poly[] = mt_rand(0, $timage[1]);
        }
        imageFilledPolygon($image, $poly, $x, imageColorAllocate($image, mt_rand(150, 255), mt_rand(150, 255), mt_rand(150, 255)));
    }
    // Création des pixels gris
    for ($i = 0; $i < $timage[0] * $timage[1] / rand(15, 18); $i++) {
        imageSetPixel($image, rand(0, $timage[0]), rand(0, $timage[1]), $grey);
    }
    // affichage du texte demandé; on le centre en hauteur et largeur (à peu près ^^")
    //imageString($image, 5, ceil($timage[0]-strlen($content)*8)/2, ceil($timage[1]/2)-9, $content, $text_color);
    $longueur_chaine = strlen($content);
    for ($ch = 0; $ch < $longueur_chaine; $ch++) {
        imagettftext($image, 18, mt_rand(-30, 30), 10 * ($ch + 1), mt_rand(18, 20), $text_color, 'res/georgia.ttf', $content[$ch]);
    }
    $type = function_exists('imageJpeg') ? 'jpeg' : 'png';
    @header('Content-Type: image/' . $type);
    @header('Cache-control: no-cache, no-store');
    $type == 'png' ? imagePng($image) : imageJpeg($image);
    ImageDestroy($image);
    exit;
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:41,代码来源:captcha.php

示例7: resizeImage

function resizeImage($file, $max_x, $max_y, $forcePng = false)
{
    if ($max_x <= 0 || $max_y <= 0) {
        $max_x = 5;
        $max_y = 5;
    }
    $src = BASEDIR . '/avatars/' . $file;
    list($width, $height, $type) = getImageSize($src);
    $scale = min($max_x / $width, $max_y / $height);
    $newWidth = $width * $scale;
    $newHeight = $height * $scale;
    $img = imagecreatefromstring(file_get_contents($src));
    $black = imagecolorallocate($img, 0, 0, 0);
    $resizedImage = imageCreateTrueColor($newWidth, $newHeight);
    imagecolortransparent($resizedImage, $black);
    imageCopyResampled($resizedImage, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
    imageDestroy($img);
    unlink($src);
    if (!$forcePng) {
        switch ($type) {
            case IMAGETYPE_JPEG:
                imageJpeg($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
            case IMAGETYPE_GIF:
                imageGif($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
            case IMAGETYPE_PNG:
                imagePng($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
            default:
                imagePng($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
        }
    } else {
        imagePng($resizedImage, BASEDIR . '/avatars/' . $file . '.png');
    }
    return;
}
开发者ID:kandran,项目名称:flyspray,代码行数:38,代码来源:modify.inc.php

示例8: save

 function save($filename, $type = 'png', $quality = 100)
 {
     $this->_build();
     $this->_build_border();
     switch ($type) {
         case 'gif':
             $ret = imageGif($this->_dest_image, $filename);
             break;
         case 'jpg':
         case 'jpeg':
             $ret = imageJpeg($this->_dest_image, $filename, $quality);
             break;
         case 'png':
             $ret = imagePng($this->_dest_image, $filename);
             break;
         default:
             $this->_error('Save: Invalid Format');
             break;
     }
     if (!$ret) {
         $this->_error('Save: Unable to save');
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:23,代码来源:Image.php

示例9: drawField

function drawField($team)
{
    $field = imagecreatefromjpeg("img/field.jpg");
    foreach ($team->players as $player) {
        $img = drawPlayer($player->number, $player->name);
        $width = imagesx($img);
        $height = imagesy($img);
        $posX = $player->x - ($width - 26) / 2;
        $posY = $player->y - 10;
        imageAlphaBlending($field, true);
        // копировать сюда будем вместе с настройками
        imageSaveAlpha($field, true);
        // сохраняем
        imageCopy($field, $img, $posX, $posY, 0, 0, $width, $height);
        //копируем картинку с формой в пустой бокс
    }
    $copyright = drawCaption("http://www.ezheloko.ru/tactic", 12, 0);
    imagecopymerge_alpha($field, $copyright, 240, imagesY($field) - 25, 0, 0, imagesX($copyright), imagesY($copyright), 30);
    $name = generateName();
    $name = "formations/" . $name . ".png";
    imagePng($field, $name);
    return $name;
}
开发者ID:renatjudo,项目名称:football-formations-generator,代码行数:23,代码来源:functions.php

示例10: all_project_tree

function all_project_tree($id_user, $completion, $project_kind)
{
    include "../include/config.php";
    $config["id_user"] = $id_user;
    $dotfilename = $config["homedir"] . "/attachment/tmp/{$id_user}.all.dot";
    $pngfilename = $config["homedir"] . "/attachment/tmp/{$id_user}.projectall.png";
    $mapfilename = $config["homedir"] . "/attachment/tmp/{$id_user}.projectall.map";
    $dotfile = fopen($dotfilename, "w");
    fwrite($dotfile, "digraph Integria {\n");
    fwrite($dotfile, "\t  ranksep=1.8;\n");
    fwrite($dotfile, "\t  ratio=auto;\n");
    fwrite($dotfile, "\t  size=\"9,9\";\n");
    fwrite($dotfile, 'URL="' . $config["base_url"] . '/index.php?sec=projects&sec2=operation/projects/project_tree";' . "\n");
    fwrite($dotfile, "\t  node[fontsize=" . $config['fontsize'] . "];\n");
    fwrite($dotfile, "\t  me [label=\"{$id_user}\", style=\"filled\", color=\"yellow\"]; \n");
    $total_project = 0;
    $total_task = 0;
    if ($project_kind == "all") {
        $sql1 = "SELECT * FROM tproject WHERE disabled = 0";
    } else {
        $sql1 = "SELECT * FROM tproject WHERE disabled = 0 AND end != '0000-00-00 00:00:00'";
    }
    if ($result1 = mysql_query($sql1)) {
        while ($row1 = mysql_fetch_array($result1)) {
            if (user_belong_project($id_user, $row1["id"], 1) == 1) {
                $project[$total_project] = $row1["id"];
                $project_name[$total_project] = $row1["name"];
                if ($completion < 0) {
                    $sql2 = "SELECT * FROM ttask WHERE id_project = " . $row1["id"];
                } elseif ($completion < 101) {
                    $sql2 = "SELECT * FROM ttask WHERE completion < {$completion} AND id_project = " . $row1["id"];
                } else {
                    $sql2 = "SELECT * FROM ttask WHERE completion = 100 AND id_project = " . $row1["id"];
                }
                if ($result2 = mysql_query($sql2)) {
                    while ($row2 = mysql_fetch_array($result2)) {
                        if (user_belong_task($id_user, $row2["id"], 1) == 1) {
                            $task[$total_task] = $row2["id"];
                            $task_name[$total_task] = $row2["name"];
                            $task_parent[$total_task] = $row2["id_parent_task"];
                            $task_project[$total_task] = $project[$total_project];
                            $task_workunit[$total_task] = get_task_workunit_hours($row2["id"]);
                            $task_completion[$total_task] = $row2["completion"];
                            $total_task++;
                        }
                    }
                }
                $total_project++;
            }
        }
    }
    // Add project items
    for ($ax = 0; $ax < $total_project; $ax++) {
        fwrite($dotfile, 'PROY' . $project[$ax] . ' [label="' . wordwrap($project_name[$ax], 12, '\\n') . '", style="filled", color="grey", URL="' . $config["base_url"] . '/index.php?sec=projects&sec2=operation/projects/task&id_project=' . $project[$ax] . '"];');
        fwrite($dotfile, "\n");
    }
    // Add task items
    for ($ax = 0; $ax < $total_task; $ax++) {
        $temp = 'TASK' . $task[$ax] . ' [label="' . wordwrap($task_name[$ax], 12, '\\n') . '"';
        if ($task_completion[$ax] < 10) {
            $temp .= 'color="red"';
        } elseif ($task_completion[$ax] < 100) {
            $temp .= 'color="yellow"';
        } elseif ($task_completion[$ax] == 100) {
            $temp .= 'color="green"';
        }
        $temp .= "URL=\"" . $config["base_url"] . "/index.php?sec=projects&sec2=operation/projects/task_detail&id_project=" . $task_project[$ax] . "&id_task=" . $task[$ax] . "&operation=view\"";
        $temp .= "];";
        fwrite($dotfile, $temp);
        fwrite($dotfile, "\n");
    }
    // Make project attach to user "me"
    for ($ax = 0; $ax < $total_project; $ax++) {
        fwrite($dotfile, 'me -> PROY' . $project[$ax] . ';');
        fwrite($dotfile, "\n");
    }
    // Make project first parent task relation visible
    for ($ax = 0; $ax < $total_task; $ax++) {
        if ($task_parent[$ax] == 0) {
            fwrite($dotfile, 'PROY' . $task_project[$ax] . ' -> TASK' . $task[$ax] . ';');
            fwrite($dotfile, "\n");
        }
    }
    // Make task-subtask parent task relation visible
    for ($ax = 0; $ax < $total_task; $ax++) {
        if ($task_parent[$ax] != 0) {
            fwrite($dotfile, 'TASK' . $task_parent[$ax] . ' -> TASK' . $task[$ax] . ';');
            fwrite($dotfile, "\n");
        }
    }
    fwrite($dotfile, "}");
    fwrite($dotfile, "\n");
    // exec ("twopi -Tpng $dotfilename -o $pngfilename");
    exec("twopi -Tcmapx -o{$mapfilename} -Tpng -o{$pngfilename} {$dotfilename}");
    Header('Content-type: image/png');
    $imgPng = imageCreateFromPng($pngfilename);
    imageAlphaBlending($imgPng, true);
    imageSaveAlpha($imgPng, true);
    imagePng($imgPng);
    require $mapfilename;
//.........这里部分代码省略.........
开发者ID:dsyman2,项目名称:integriaims,代码行数:101,代码来源:functions_graph.php

示例11: ImageGif

             ImageGif($im1, $imagnam, $quality);
             echo "<img src='" . $imagnam . "' alt=''/><br/>";
             break;
         case "jpg":
             $imagnam = "temp/{$namefile}.temp.jpg";
             imageJpeg($im1, $imagnam, $quality);
             echo "<img src='" . $imagnam . "' alt=''/><br/>";
             break;
         case "jpeg":
             $imagnam = "temp/{$namefile}.temp.jpg";
             imageJpeg($im1, $imagnam, $quality);
             echo "<img src='" . $imagnam . "' alt=''/><br/>";
             break;
         case "png":
             $imagnam = "temp/{$namefile}.temp.png";
             imagePng($im1, $imagnam, $quality);
             echo "<img src='" . $imagnam . "' alt=''/><br/>";
             break;
     }
     imagedestroy($im);
     imagedestroy($im1);
     $kom = mysql_query("select * from `gallery` where type='km' and refid='" . $newf['id'] . "';");
     $kom1 = mysql_num_rows($kom);
     echo "</a><br/>" . $lng['date'] . ': ' . functions::display_date($newf['time']) . '<br/>' . $lng['description'] . ": {$newf['text']}<br/>";
     $al = mysql_query("select * from `gallery` where type = 'al' and id = '" . $newf['refid'] . "';");
     $al1 = mysql_fetch_array($al);
     $rz = mysql_query("select * from `gallery` where type = 'rz' and id = '" . $al1['refid'] . "';");
     $rz1 = mysql_fetch_array($rz);
     echo '<a href="index.php?id=' . $al1['id'] . '">' . $rz1['text'] . '&#160;/&#160;' . $al1['text'] . '</a></div>';
 }
 ++$i;
开发者ID:chegestar,项目名称:catroxs,代码行数:31,代码来源:new.php

示例12: createNewImage

 private function createNewImage($newImg, $newName, $imgInfo)
 {
     $this->path = rtrim($this->path, "/") . "/";
     switch ($imgInfo["type"]) {
         case 1:
             //gif
             $result = imageGIF($newImg, $this->path . $newName);
             break;
         case 2:
             //jpg
             $result = imageJPEG($newImg, $this->path . $newName);
             break;
         case 3:
             //png
             $result = imagePng($newImg, $this->path . $newName);
             break;
     }
     imagedestroy($newImg);
     return $newName;
 }
开发者ID:mikelkl,项目名称:online_exam,代码行数:20,代码来源:image.class.php

示例13: count

$charImageStep = $imageWidth / ($charsNumber + 1);
$charWritePoint = $charImageStep;
// Write captcha characters to the image
for ($i = 0; $i < $charsNumber; $i++) {
    $nextChar = $characters[mt_rand(0, count($characters) - 1)];
    $captchaText .= $nextChar;
    // Font properties
    $randomFontSize = mt_rand(25, 30);
    // Random character size to spice things a little bit :)
    $randomFontAngle = mt_rand(-25, 25);
    // Twist the character a little bit
    $fontType = select_captcha_font();
    // This is the font we are using - we need to point to the ttf file here
    // Pixels
    $pixelX = $charWritePoint;
    // We will write a character at this X point
    $pixelY = 40;
    // We will write a character at this Y point
    // Random character color								  // R			  // G			  // B			  // Alpha
    $randomCharColor = imageColorAllocateAlpha($captchaImage, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 25));
    // Write a character to the image
    imageTtfText($captchaImage, $randomFontSize, $randomFontAngle, $pixelX, $pixelY, $randomCharColor, $fontType, $nextChar);
    // Increase captcha step
    $charWritePoint += $charImageStep;
}
// Add currently generated captcha text to the session
$_SESSION['login_captcha'] = $captchaText;
// Return the image
return imagePng($captchaImage);
// Destroy captcha image
imageDestroy($captchaImage);
开发者ID:Alimir,项目名称:ajax-bootmodal-login,代码行数:31,代码来源:log-captcha.php

示例14: imageColorAllocate

    $textColor = imageColorAllocate($image, rand(0, 100), rand(0, 100), rand(0, 100));
    $font = rand(1, 4) . ".ttf";
    $randsize = rand($size - $size / 10, $size + $size / 10);
    $location = $left + ($i * $size + $size / 10);
    imagettftext($image, $randsize, rand(-18, 18), $location, rand($size - $size / 10, $size + $size / 10), $textColor, $font, $randtext);
}
if ($noise == true) {
    setnoise();
}
$_SESSION['cv_yzm'] = $code;
$bordercolor = getcolor($bordercolor);
if ($border == true) {
    imageRectangle($image, 0, 0, $width - 1, $height - 1, $bordercolor);
}
header("Content-type: image/png");
imagePng($image);
imagedestroy($image);
function getcolor($color)
{
    global $image;
    $color = eregi_replace("^#", "", $color);
    $r = $color[0] . $color[1];
    $r = hexdec($r);
    $b = $color[2] . $color[3];
    $b = hexdec($b);
    $g = $color[4] . $color[5];
    $g = hexdec($g);
    $color = imagecolorallocate($image, $r, $b, $g);
    return $color;
}
function setnoise()
开发者ID:songht7,项目名称:brandor,代码行数:31,代码来源:yzm.php

示例15: getTemporaryImageWithText

 /**
  * Creates error image based on gfx/notfound_thumb.png
  * Requires GD lib enabled, otherwise it will exit with the three
  * textstrings outputted as text. Outputs the image stream to browser and exits!
  *
  * @param string $filename Name of the file
  * @param string $textline1 Text line 1
  * @param string $textline2 Text line 2
  * @param string $textline3 Text line 3
  * @return void
  * @throws \RuntimeException
  *
  * @internal Don't use this method from outside the LocalImageProcessor!
  */
 public function getTemporaryImageWithText($filename, $textline1, $textline2, $textline3)
 {
     if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
         throw new \RuntimeException('TYPO3 Fatal Error: No gdlib. ' . $textline1 . ' ' . $textline2 . ' ' . $textline3, 1270853952);
     }
     // Creates the basis for the error image
     if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']) {
         $im = imagecreatefrompng(PATH_typo3 . 'gfx/notfound_thumb.png');
     } else {
         $im = imagecreatefromgif(PATH_typo3 . 'gfx/notfound_thumb.gif');
     }
     // Sets background color and print color.
     $white = imageColorAllocate($im, 255, 255, 255);
     $black = imageColorAllocate($im, 0, 0, 0);
     // Prints the text strings with the build-in font functions of GD
     $x = 0;
     $font = 0;
     if ($textline1) {
         imagefilledrectangle($im, $x, 9, 56, 16, $white);
         imageString($im, $font, $x, 9, $textline1, $black);
     }
     if ($textline2) {
         imagefilledrectangle($im, $x, 19, 56, 26, $white);
         imageString($im, $font, $x, 19, $textline2, $black);
     }
     if ($textline3) {
         imagefilledrectangle($im, $x, 29, 56, 36, $white);
         imageString($im, $font, $x, 29, substr($textline3, -14), $black);
     }
     // Outputting the image stream and exit
     if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']) {
         imagePng($im, $filename);
     } else {
         imageGif($im, $filename);
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:50,代码来源:LocalImageProcessor.php


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