怎么计算 imagestring($source,$font_size,$x,$y,$string,$color) 中$font_size(除去预置的1-5)设置的字体大小所对应的像素值??这边的$font_size(除去预置的1-5)设置的字体大小的单位是什么?? 即若是$font_size=15,那是指字体大小为15px??
Reply content:
怎么计算 imagestring($source,$font_size,$x,$y,$string,$color) 中$font_size(除去预置的1-5)设置的字体大小所对应的像素值??这边的$font_size(除去预置的1-5)设置的字体大小的单位是什么?? 即若是$font_size=15,那是指字体大小为15px??
You can use imagettfbbox
functions to calculate the height width of the string for a TTF font, and use it imagettftext
to write images
http://php.net/manual/zh/function.imagettfbbox.php
http://php.net/manual/zh/function.imagettftext.php
Add:
You mentioned the imagestring
function, the second parameter is not fontsize
what font
, but is GD prefabricated 5 font, size you can not modify , if you want to use the extra font, need to use the imageloadfont
function to load, loading is not TTF font, so your period The effect of looking at these two functions is not possible.
http://php.net/manual/zh/function.imagestring.php
http://php.net/manual/zh/function.imageloadfont.php