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

php 生成文字png圖片的代碼

復制代碼 代碼如下:
<?
/*
php生成文字png圖片,可以使用如下方式調用函數:
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'; //默認字體. 相對于腳本存放目錄的相對路徑.
var $msg = "undefined"; // 默認文字.
var $size = 24;
var $rot = 0; // 旋轉角度.
var $pad = 0; // 填充.
var $transparent = 1; // 文字透明度.
var $red = 0; // 在黑色背景中...
var $grn = 0;
var $blu = 0;
var $bg_red = 255; // 將文字設置為白色.
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; // 旋轉角度
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技術php 生成文字png圖片的代碼,轉載需保留來源!

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

主站蜘蛛池模板: 俄罗斯老妇女BBXX | 老汉老太bbbbbxxxxx | 国产成人精品视频免费大全 | 欧美乱妇狂野欧美在线视频 | YY6080A旧里番在线观看 | Chinesetube国产中文 | 欧美巨大xxxx做受高清 | 国产激情视频在线观看 | 国内精品一级毛片免费看 | 两个客户一起吃我的奶 | 伊伊人成亚洲综合人网 | 翘臀后进美女白嫩屁股视频 | 日日噜噜夜夜爽爽 | 久久99re2热在线播放7 | 国语自产精品一区在线视频观看 | 久久6699精品国产人妻 | 伊人久久综合影院首页 | 精品人伦一区二区三区潘金莲 | 狠狠婷婷综合久久久久久 | 强开少妇嫩苞又嫩又紧九色 | 亚洲 无码 在线 专区 | 三级黄网站 | 国产成人精品视频免费大全 | 熟女人妻AV五十路六十路 | 菠萝菠萝蜜高清观看在线 | 人善交XUANWEN200喷水 | 四虎亚洲中文字幕永久在线 | 试看做受120秒免费午夜剧场 | 国产在线精品亚洲一品区 | 国产精华av午夜在线观看 | 欧美精品九九99久久在免费线 | 花蝴蝶hd免费 | 总攻催眠受的高h巨肉np | 超碰免费碰免费视频 | 高H高肉强J短篇NP | 亚洲国产精品久久又爽黄A片 | 十分钟免费观看高清视频大全 | 久久亚洲国产精品亚洲 | 国产成人无码区免费内射一片色欲 | 精品麻豆一卡2卡三卡4卡乱码 | 24小时日本在线观看片 |