When I put on-line onto OVH (host provider) a blog that I developed on my local network under EasyPhp 3.0.0 (Php 5.2.8) and under Wordpress 2.7.1, I realized something went wrong using the plugin TTF TITLES. The image generated by PHP via the plugin was truncated at the bottom part and could not establish anymore the limits of the Font box whatever the Font type or size. The result being a constantly “cut” image.

The image result of the ‘bug’:
article_ttf_ex1

The image result after our little Hack:
(or how it should have normally been with PHP 5.2.8 and  < )
article_ttf_ex2

Searching on the web I found an explanation, or rather the report for his problem concerning  the use of the module PHP ‘ imagettfbbox ‘ in the versions PHP 5.2.10 >. The calculation of the height changed and some of the plugin or programs that worked dynamically to create an image in PHP don’t work anymore! I did not find the reasons for this modification (if there is any!) but apparently future versions of PHP will take this bug in account.

While waiting … If the problem comes from the calculation of the box height , it’s enough to indicate to TTF Titles to increase this height:

File « ttftitles.php », go to the line 674 :

$height = $effecty + (max($bbox[1],$bbox[3],$bbox[5],$bbox[7]) - min($bbox[1],$bbox[3],$bbox[5],$bbox[7])); 

Replace it by :

$height = $effecty + (max($bbox[1],$bbox[3],$bbox[5],$bbox[7]) - min($bbox[1],$bbox[3],$bbox[5],$bbox[7]))+7;  

We added +7 at the end of the line, but obviously the value of this sum can vary according to the Font and the used size. Clean the directory CACHE from TTFTitles and that’a all.  Wish I could help the fans of this fantastic plugin!

NB: it seems that PHP 5.2.9 works still well with TTF Titles, and that PHP 2.3.0 did not. But I did not test it personally.

The Plugin TTF Titles :
Downloading page of the Plugin
Sources used for this article :
Page of the referencing of the bug
Page of a php generator php of font


Bookmark and Share