GD尝试加载字体时出错 [英] GD error while try load font

查看:493
本文介绍了GD尝试加载字体时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过 imageloadfont 函数加载字体。当我运行脚本时,我收到错误:

  gd警告:内存分配乘积乘积将超过INT_MAX,优雅地失败操作
PHP警告:imageloadfont():读取字体错误,无效的字体标题

什么会导致这个问题?

$ en $:

Ubuntu 13.04 64位

< PHP的5.4.9-4ubuntu2.3

解决方案

我找到了解决方案。这个问题不在imageloadfont函数中。



我试图加载字体(.ttf)到imageloadfont并将其设置在图像上。我现在使用imagettftext来加载自定义字体,并将字符串放在图片上,而不是使用图像字符串函数。


I try load font by imageloadfont function. When I running script I receive error:

gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
PHP Warning:  imageloadfont(): Error reading font, invalid font header

What can cause this problem?

Env:

Ubuntu 13.04 64-bit

PHP 5.4.9-4ubuntu2.3

解决方案

I found the solution. The problem wasn't in the imageloadfont function.

I was trying to load the font (.ttf) to imageloadfont and set it on the image. Instead of using the imagestring function, I now used imagettftext to load the custom font and place the string on the picture.

这篇关于GD尝试加载字体时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆