首页 > 其他 > 详细

封装的可以控制往图片上写字,控制字符间距的方法

时间:2015-11-25 17:05:53      阅读:260      评论:0      收藏:0      [点我收藏+]
$image = ImageCreateFromJPEG( "img/6.jpg" );
$cor = imagecolorallocate($image, 0, 0, 0);
$font = ‘debiao.ttf‘;
$tt = ‘我们的灵魂‘;
$a = im($image, 120, 0, 150, 150, $cor, $font, $tt,50);
header(‘Content-type: image/jpeg‘);
imagejpeg($image);

function im(&$image, $size, $angle, $start_x, $y, $color, $font, $text,$spancing) {

for ($i=0;$i<mb_strlen($text,‘utf8‘);$i++) {
	$t = mb_substr($text, $i,1,‘utf8‘);
	$x = $i*($size+$spancing);
	imagettftext($image, $size, $angle, $x+$start_x, $y, $color, $font, $t);
	}	

}

封装的可以控制往图片上写字,控制字符间距的方法

封装的可以控制往图片上写字,控制字符间距的方法

原文:http://chenxiaolong.blog.51cto.com/8786841/1716746

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!