天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php 生成文字png圖片的代碼

復(fù)制代碼 代碼如下:
<?
/*
php生成文字png圖片,可以使用如下方式調(diào)用函數(shù):
http://www.yourdomian.com/text_png.php3?msg=helloworld+class&rot=15&size=48&font=fonts/ARIAL.TTF
*/
Header("Content-type: image/png");
class textPNG {
var $font = 'fonts/TIMES.TTF'; //默認(rèn)字體. 相對于腳本存放目錄的相對路徑.
var $msg = "undefined"; // 默認(rèn)文字.
var $size = 24;
var $rot = 0; // 旋轉(zhuǎn)角度.
var $pad = 0; // 填充.
var $transparent = 1; // 文字透明度.
var $red = 0; // 在黑色背景中...
var $grn = 0;
var $blu = 0;
var $bg_red = 255; // 將文字設(shè)置為白色.
var $bg_grn = 255;
var $bg_blu = 255;
function draw() {
$width = 0;
$height = 0;
$offset_x = 0;
$offset_y = 0;
$bounds = array();
$image = "";
// 確定文字高度.
$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, "W");
if ($this->rot < 0) {
$font_height = abs($bounds[7]-$bounds[1]);
} else if ($this->rot > 0) {
$font_height = abs($bounds[1]-$bounds[7]);
} else {
$font_height = abs($bounds[7]-$bounds[1]);
}
// 確定邊框高度.
$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, $this->msg);
if ($this->rot < 0) {
$width = abs($bounds[4]-$bounds[0]);
$height = abs($bounds[3]-$bounds[7]);
$offset_y = $font_height;
$offset_x = 0;
} else if ($this->rot > 0) {
$width = abs($bounds[2]-$bounds[6]);
$height = abs($bounds[1]-$bounds[5]);
$offset_y = abs($bounds[7]-$bounds[5])+$font_height;
$offset_x = abs($bounds[0]-$bounds[6]);
} else {
$width = abs($bounds[4]-$bounds[6]);
$height = abs($bounds[7]-$bounds[1]);
$offset_y = $font_height;;
$offset_x = 0;
}
$image = imagecreate($width+($this->pad*2)+1,$height+($this->pad*2)+1);
$background = ImageColorAllocate($image, $this->bg_red, $this->bg_grn, $this->bg_blu);
$foreground = ImageColorAllocate($image, $this->red, $this->grn, $this->blu);
if ($this->transparent) ImageColorTransparent($image, $background);
ImageInterlace($image, false);
// 畫圖.
ImageTTFText($image, $this->size, $this->rot, $offset_x+$this->pad, $offset_y+$this->pad, $foreground, $this->font, $this->msg);
// 輸出為png格式.
imagePNG($image);
}
}
$text = new textPNG;
if (isset($msg)) $text->msg = $msg; // 需要顯示的文字
if (isset($font)) $text->font = $font; // 字體
if (isset($size)) $text->size = $size; // 文字大小
if (isset($rot)) $text->rot = $rot; // 旋轉(zhuǎn)角度
if (isset($pad)) $text->pad = $pad; // padding
if (isset($red)) $text->red = $red; // 文字顏色
if (isset($grn)) $text->grn = $grn; // ..
if (isset($blu)) $text->blu = $blu; // ..
if (isset($bg_red)) $text->bg_red = $bg_red; // 背景顏色.
if (isset($bg_grn)) $text->bg_grn = $bg_grn; // ..
if (isset($bg_blu)) $text->bg_blu = $bg_blu; // ..
if (isset($tr)) $text->transparent = $tr; // 透明度 (boolean).
$text->draw();
?>

php技術(shù)php 生成文字png圖片的代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 色欲AV蜜臀AV在线观看麻豆 | 亚洲精品久久久久AV无码 | X8X8拨牐拨牐X8免费视频8午夜 | 日韩AV无码一区二区三区不卡毛片 | 99久女女精品视频在线观看 | 国产亚洲高清视频 | 青柠在线观看免费播放电影 | 美女视频秀色福利视频 | 国内精品免费视频精选在线观看 | 欧美派对xxxhdparty | 茎身铃口调教 | 国产乱辈通伦影片在线播放亚洲 | 亚欧免费观看在线观看更新 | 囯产精品麻豆巨作久久 | 久久精品99热超碰 | 孕妇bbwbbwbbwbbw超清 | 果冻传媒在线观看进入窗口 | 亚洲大码熟女在线 | 成人免费在线 | 日本VA在线视频播放 | 97人人看碰人免费公开视频 | 亚洲欧美日本久久综合网站 | 欧美午夜精品一区区电影 | 波多野结衣 无码片 | 日本高清加勒比 | 久久国产36精品色熟妇 | 午夜色网站 | 蜜臀AV精品一区二区三区 | 人妻夜夜爽天天爽三区麻豆AV网站 | 国内精品久久久久久西瓜色吧 | 中国老太性色xxxxxhd | 亚洲国产av| 99九九精品视频 | 先锋影音av资源站av | 伦理片在线线看手机版 | 亚洲国产中文字幕在线视频 | 皮皮在线精品亚洲 | 亚洲最大日夜无码中文字幕 | 久久妇女高潮几次MBA | 日本黄色成年人免费观看 | 金发欧美一区在线观看 |