My script functions fine if I use Arial as the font, but when I try to use a font that's not in the current directory (setting the GD path with putenv) it tells me it can't find the font.
If it helps, this is my script:
Code:
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
$homedir = "http://www.mtaonline.net/~dburton/";
putenv("GDFONTPATH=$homedir");
//These entities should output the hanzi numerals for one, two, and three
$text = '一二三';
$font = 'HDZB_35.TTF';
imagettftext($im, 12, 0, 10, 20, $black, $font, $text);
imagepng($im);
imagedestroy($im);
?>
I only called the font from an outside URL due to the fact that it's more than 500KB (most fonts are). Yes, I have opened the full URL to the font in my browser, and it works.
This works (albeit the fact it outputs the entities instead of the corresponding characters):
Code:
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
$text = "一二三";
$font = "Arial";
imagettftext($im, 12, 0, 10, 20, $black, $font, $text);
imagepng($im);
imagedestroy($im);
?>
How should I direct GD to my font?