Hi

I keep getting a error in the following code:
<?

# variables
$pic = "./images/button_bg.jpg";
$fontfile = "arial.ttf";
$fontsize = "12";
$fontcolor = "#000000";
$textangle = "0";
$text = (isset($text) ? rawurldecode($text) : "OhReally"); # should be set in 
query_string

# create pic and fontcolor
$pic = imagecreatefromjpeg($pic);
$fontcolor = str_replace("#", "", $fontcolor);
$fontcolor = imagecolorallocate($pic, hexdec(substr($fontcolor, 0, 2)), 
hexdec(substr($fontcolor, 2, 2)), hexdec(substr($fontcolor, 4, 2)));

# calculate start position
$picwidth = imagesx($pic);
$picheight = imagesy($pic);
list($pos_blx, $pos_bly, $pos_brx, $pos_bry, $pos_trx, $pos_try, $pos_tlx, $pos_tly) = 
imagettfbbox($fontsize, $textangle, $fontfile, $text);
$textwidth = $pos_brx - $pos_blx;
$textheight = $pos_bly - $pos_tly;
$start_x = ($picwidth - $textwidth) / 2;
$start_y = (($picheight - $textheight) / 2) + $textheight;

# write text and output image
imagettftext($pic, $fontsize, $textangle, $start_x, $start_y, $fontcolor, $fontfile, 
$text);
header("content-type: image/jpeg");
imagejpeg($pic);
imagedestroy($pic);
?>

if called directly with:

thepic.php?text=test

then I get:
Warning: Could not find/open font in d:\www\webreklamer\thepic.php on line 19

Warning: Could not find/open font in d:\www\webreklamer\thepic.php on line 26

And the arial.ttf IS in the same directory as the script.

What am I missing ?

Thanks in advance.

Best
Steen

Reply via email to