php GD (php4 vs php5)

Soldato
Joined
6 Feb 2004
Posts
20,843
Location
England
any ideas why php4 renders fonts differently compared to php5 when using the exact same code/font?

php4
upload


php5
upload


notice the gap between the 'm' and 'b' in the word lamb. this happens with all sorts of other letter combinations too. you might think i'm being anal but it's quite a difference.... :o

i'm probably clutching at straws here but is there anything i can do to fix it. i'm guessing not but it just puzzles me why it behaves so differently? :confused:

it's only free webspace with my isp so i'm unlikely to get very far if i ask for php 5. :D
 
id guess its because of the version of GD that is bundled with each version of PHP. if you could update PHP4 to use the version of GD used in PHP5, then id imagine the output would be the same?
 
well like i said above, it's only free webspace. i certainly can't be upgrading anything on the system. i might log a ticket asking when it will be upgaded to php5. :)

kind of a pointless thread really, i already know there's nothing i can do about it..... :o
 
o0, i might consider right-aligning something if its easy :)

you calculate the width the text will take up using imagettfbox.

http://www.php.net/imagettfbbox

then with that width, use a little basic maths to work out the x co-ordinate to use with imagettftext. eg

x = overwallwidth - margin - width of text

give us a shout if you get stuck - you shouldn't do though. :p
 
Back
Top Bottom