User:Vijay/Trouble Shooting/bioinformatics

From OpenWetWare

Jump to: navigation, search

PHP IMAGE generation problem, Invalid font filename

Warning: imagettftext() [function.imagettftext]: Invalid font filename in D:\Program Files\xampp\htdocs\vennpic.php on line 126

SOLUTION 1
I switched from PHP5 to PHP4 and it worked. Some bug in PHP5 causes this problem.



SOLUTION 2
Solution 1 was ok for a while, but when We wanted to host our database on a commercial server space, we were not able to ... due to the PHP version problem, since they cant switch back to old PHP... we didnt have any other option but to look at our code and make it work for PHP 5x.

After a lot of search for help in the net... (most of them were really making things too complicated...) i finally got it working. This is how i did it.

Just include the font file (for example arial.ttf) in the same folder where my php code was and then specified this file name with .ttf extension in the code. It would like a magic.

Rather than figuring out .... how to fix the font path problem, this look more of an easy and straight forward solution to me.

Personal tools