我目前生成了一个能生成透明的PNN图片
<?php
// Set the content-type
header ( 'Content-type: image/png' );
// Create the image
$font_size = 18; //字体大小 14px
$text = '有朋自远方来。不亦乐呼';
// Replace path by your own font path
//$text = iconv("gb2312","UTF-8",$text);
$font = 'D:\\ComsenzEXP\\wwwroot\\jquery\\fonts\\方正大黑繁体.ttf';
$font = iconv("UTF-8","gb2312",$font);
//imagepsslantfont ($font, 0.1 );
$fontarea = imagettfbbox($font_size,0,$font,$text); //确定会变化的字符串的位置$text_width = $fontarea[2]-$fontarea[0]+($font_size/3); //字符串文本框长度
$text_height = $fontarea[1]-$fontarea[7]+($font_size/3); ////字符串文本框高度
$im = imagecreate( $text_width , $text_height );
// Create some colors
$white = imagecolorallocate($im, 255,255,255); //定义透明色
$red = imagecolorallocate ( $im , 255 , 0 , 0); //文本色彩//imagecolortransparent($im,$white);
//imagefilledrectangle ( $im , 0 , 0 , 152 , 30 , $white ); //生成背景色
//ImageColorTransparent($img,$bgcolor);
// The text to draw // Add some shadow to the text
imagettftext ( $im , $font_size , 0 , 0, $text_height-($font_size/2.5) , $red , $font , $text );
imagecolortransparent($im,$white);
imagepng ( $im );
imagedestroy ($im);
?> 字体加粗,斜体就没有这个选项。有谁知道吗。
<?php
// Set the content-type
header ( 'Content-type: image/png' );
// Create the image
$font_size = 18; //字体大小 14px
$text = '有朋自远方来。不亦乐呼';
// Replace path by your own font path
//$text = iconv("gb2312","UTF-8",$text);
$font = 'D:\\ComsenzEXP\\wwwroot\\jquery\\fonts\\方正大黑繁体.ttf';
$font = iconv("UTF-8","gb2312",$font);
//imagepsslantfont ($font, 0.1 );
$fontarea = imagettfbbox($font_size,0,$font,$text); //确定会变化的字符串的位置$text_width = $fontarea[2]-$fontarea[0]+($font_size/3); //字符串文本框长度
$text_height = $fontarea[1]-$fontarea[7]+($font_size/3); ////字符串文本框高度
$im = imagecreate( $text_width , $text_height );
// Create some colors
$white = imagecolorallocate($im, 255,255,255); //定义透明色
$red = imagecolorallocate ( $im , 255 , 0 , 0); //文本色彩//imagecolortransparent($im,$white);
//imagefilledrectangle ( $im , 0 , 0 , 152 , 30 , $white ); //生成背景色
//ImageColorTransparent($img,$bgcolor);
// The text to draw // Add some shadow to the text
imagettftext ( $im , $font_size , 0 , 0, $text_height-($font_size/2.5) , $red , $font , $text );
imagecolortransparent($im,$white);
imagepng ( $im );
imagedestroy ($im);
?> 字体加粗,斜体就没有这个选项。有谁知道吗。
aspx.net http://www.kkdiy.com/diy/diy47.aspx
还有一个卡当网
http://www.kadang.com他们都能生成加粗和斜体的字.