I'm creating a gif using php and gd library. I'm developing on Windows XP with a local installation of Apache and PHP 4.3.11. The gif is created exactly as expected. But when I upload to my webhost (Linux, PHP 4.3.11) the text is left aligned! It's as if the fourth parameter of imagettftext is being ignored for some bizarre reason.
Here's a screenshot of the result on my Windows PC:
And here's a screenshot of the result on my LAMP-based webhost.
Anyone got any ideas?
Here's the PHP code:
<?php
header("Content-type: image/gif");
$image = imagecreatefromgif("imgs/heading_boilerplate.gif");
$line1_text = $_GET['line1'];
$line1_color = imagecolorallocate($image, 0, 0, 0); //black
$line1_x = 44;
$line1_y = 37;
$line1_size = 24;
$line1_font = './fonts/georgia.ttf';$line2_text = $_GET['line2'];
$line2_color = imagecolorallocate($image, 66, 66, 66); //grey
$line2_x = 126;
$line2_y = 59;
$line2_size = 16;
$line2_font = './fonts/georgia.ttf';imagettftext($image, $line1_size, 0, $line1_x, $line1_y, $line1_color, $line1_font, $line1_text);
imagettftext($image, $line2_size, 0, $line2_x, $line2_y, $line2_color, $line2_font, $line2_text);imagegif($image);
imagedestroy($image);?>