天天躁日日躁狠狠躁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圖片的代碼,轉載需保留來源!

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

主站蜘蛛池模板: 色人阁综合 | 国产精品爽爽久久久久久蜜桃 | 99亚偷拍自图区亚洲 | 日本韩国欧美一区 | 国色精品VA在线观看免费视频 | 日本亚洲精品色婷婷在线影院 | 精品国产mmd在线观看 | 翘臀后进美女白嫩屁股视频 | 日本一区不卡在线播放视频免费 | 国精产品一区二区三区有限公司 | 欧美日韩亚洲中字二区 | 嫩草影院永久在线一二三四 | 久久大香萑太香蕉av | 日本黄色网站在线观看 | 98久久人妻少妇激情啪啪 | 亚洲一级电影 | 邪恶肉肉全彩色无遮琉璃神社 | 欧美性受xxxx狂喷水 | 亚洲绝美精品一区二区 | 欧美亚洲国产激情一区二区 | 亚洲一区二区免费看 | 美目盼兮amy198281 | 国产成人免费a在线资源 | 收集最新中文国产中文字幕 | 小莹的性荡生活45章 | 中文字幕 亚洲 有码 在线 | 四虎国产精品永久一区高清 | 国产精品网红女主播久久久 | 棉袜足j吐奶视频 | 国产毛片女人高潮叫声 | 国产高清精品国语特黄A片 国产高清国内精品福利色噜噜 | 亚洲中字慕日产2020 | 精品久久香蕉国产线看观看麻豆 | 在线日本高清日本免费 | 伊人久久大香线蕉综合影 | 99riav9 精品香蕉免费大视频 | 全免费A敌肛交毛片免费懂色AV | 精品欧美小视频在线观看 | 亚洲精品视频免费观看 | 精品欧美一区二区三区四区 | 蜜臀AV中文字幕熟女人妻 |