我有越来越的问题imagefttext()
,并imagettftext()
在PHP工作。
这是一个类似于imagettftext()的问题,但是我没有收到错误消息。我将在此处简化代码以显示其基础。我已经尝试了下面的每一行。
没有错误:
imagefttext($image2, 20, 0, 0, 20, $white , 'Alien-Encounters-Regular', "testing");
imagefttext($image2, 20, 0, 0, 20, $white , 'Alien-Encounters-Regular.ttf', "testing");
imagefttext($image2, 20, 0, 0, 20, $white , './Alien-Encounters-Regular.ttf', "testing");
imagettftext($image2, 20, 0, 0, 20, $white , 'Alien-Encounters-Regular', "testing");
imagettftext($image2, 20, 0, 0, 20, $white , 'Alien-Encounters-Regular.ttf', "testing");
imagettftext($image2, 20, 0, 0, 20, $white , './Alien-Encounters-Regular.ttf', "testing");
上面所有这些都会产生一系列白色框,其中应该有一个字母。为了进一步进行故障排除,我在上面的每一行都进行了上传并进行了尝试。然后,我将字体文件名中的“ A”更改为“ a”,但没有一个告诉我这是基于Unix的服务器。(大写很重要)下面,我将发布一些工作代码,以产生带有文本的图像。
imagestring( $image2, 4, 10, 5, "testing" , $white );
我知道FreeType已安装到服务器,否则当我尝试使用FreeType时,它甚至都不会给我一个映像,并且会引发任何错误。我没有尝试过另一种设置字体文件的方法,因为这种情况下不需要。(它仍然会读取文件。否则会给我一个错误。)
更新:由于有了Elias,现在可以解决此问题,在大约1500行代码中,我只有一小部分代码,这是旧代码的一部分。此代码是imagealphablending($image2, false)
和imagettftext()
以及imagefttext()
不与alphablending下班(设置为false。)我删除了代码,它现在可以按预期。现在看下面的样子。
这些是可能相关的一些问题:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句