1

Attempting to load a font using imageloadfont and am running into the following error:

imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully

Below is the code that is causing the problem. It's... pretty basic.

imageloadfont(APPPATH.'fonts/lora/lora-regular.ttf');

I'm using the FuelPHP framework, which I think is somehow to blame, as I can create a basic .php file in the localhost root (outside of framework) and loading of the above font file works fine.

Anti-Dentite
  • 551
  • 1
  • 6
  • 11

2 Answers2

2

Those functions take a .gdf font, ttf requires using imagettftext or imagefttext.

ZJR
  • 9,308
  • 5
  • 31
  • 38
0

Same mistake as GD error while try load font?

There has also been a bug a libgd in early PHP 5.5 which caused this, and is since fixed. But since you say a test file doesn't have this problem, this can't be it?

It is a standard PHP function call, so how could FuelPHP be to blame? It is not involved anywhere in that call. Are you sure that file is in ./fuel/app/fonts... ?

Since FuelPHP (by default) fails immediately on any PHP error/warning/notice, it can be that you see this, but you miss the next warning: Warning: imageloadfont() [function.imageloadfont]: Error reading font, invalid font header in ... on line ..., or any other warning related to the filename not being correct.

Community
  • 1
  • 1
WanWizard
  • 2,574
  • 15
  • 13