84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
怎么计算 imagestring($source,$font_size,$x,$y,$string,$color) 中$font_size(除去预置的1-5)设置的字体大小所对应的像素值?? 这边的$font_size(除去预置的1-5)设置的字体大小的单位是什么?? 即若是$font_size=15,那是指字体大小为15px??
认证0级讲师
你可以使用 imagettfbbox 函数来计算TTF字体的字符串的高度宽度, 并且用 imagettftext 来写入图像
imagettfbbox
imagettftext
http://php.net/manual/zh/function.imagettfbbox.phphttp://php.net/manual/zh/function.imagettftext.php
补充:你提到的 imagestring 函数, 第二个参数不是什么 fontsize 而是 font, 是GD预制的5个字体, 大小你是不能修改的, 如果你希望采用额外的字体, 需要用 imageloadfont 函数来加载, 加载的也并不是ttf字体, 所以你期望的效果如果通过这两个函数是不行的
imagestring
fontsize
font
imageloadfont
http://php.net/manual/zh/function.imagestring.phphttp://php.net/manual/zh/function.imageloadfont.php
你可以使用
imagettfbbox
函数来计算TTF字体的字符串的高度宽度, 并且用imagettftext
来写入图像http://php.net/manual/zh/function.imagettfbbox.php
http://php.net/manual/zh/function.imagettftext.php
补充:
你提到的
imagestring
函数, 第二个参数不是什么fontsize
而是font
, 是GD预制的5个字体, 大小你是不能修改的, 如果你希望采用额外的字体, 需要用imageloadfont
函数来加载, 加载的也并不是ttf字体, 所以你期望的效果如果通过这两个函数是不行的http://php.net/manual/zh/function.imagestring.php
http://php.net/manual/zh/function.imageloadfont.php