Anti-Dentite
Anti-Dentite

Reputation: 591

imageloadfont memory allocation multiplication would exceed INT_MAX

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.

Upvotes: 1

Views: 3012

Answers (2)

ZJR
ZJR

Reputation: 9572

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

Upvotes: 2

WanWizard
WanWizard

Reputation: 2574

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.

Upvotes: 0

Related Questions