GD文字大小不变
GD text size not changing
我编写了使用 GD 将文本添加到图像中的代码;它确实有效,但大小没有无缘无故地改变。
这是我的代码:
$image = imagecreatefromjpeg(path);
$text_number = '5101';
$font_size = 20;
$font_color = imagecolorallocate($image,255,255,255);
imagestring($image,$font_size,380,240,$text_number,$font_color);
imagejpeg($image,path to save , 100);
我尝试更改 $font_size
,它不起作用
没有效果
谢谢。
我认为 20 作为 imagestring 的参数太大了。
定义为
bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )
只要您没有加载自己的字体,$font 的最大值为 5。
我编写了使用 GD 将文本添加到图像中的代码;它确实有效,但大小没有无缘无故地改变。
这是我的代码:
$image = imagecreatefromjpeg(path);
$text_number = '5101';
$font_size = 20;
$font_color = imagecolorallocate($image,255,255,255);
imagestring($image,$font_size,380,240,$text_number,$font_color);
imagejpeg($image,path to save , 100);
我尝试更改 $font_size
,它不起作用
没有效果
谢谢。
我认为 20 作为 imagestring 的参数太大了。
定义为
bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )
只要您没有加载自己的字体,$font 的最大值为 5。