php - GD文字大小不变
问题描述
我编写了使用 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 对于图像字符串的参数来说太大了。
它定义为
bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )
$font 的最大值为 5,只要您没有加载自己的字体。
推荐阅读
- python - 如何使用带有嵌套子级的python parse json
- java - 如果出现用户输入错误,如何防止处理我的 Java 代码?
- initialization - 如果您尝试将信号量初始化为负值会发生什么
- lua - Lua 定时鼠标宏 (logiteck api)
- django - 即使只有一个需要用户输入,我是否必须将所有字段添加到 ModelForm?
- elf - 如何从 .elf 文件中获取所有字符串?
- c# - LinQ 查询动态条件列表
- prolog - 如何从另一个谓词调用谓词 - Prolog
- javascript - Angular http.get() 检测调用超时
- excel - 如何从表中提取值并创建新表