Page 1 of 1

Using Fonts when creating images.

Posted: Fri Oct 25, 2002 1:45 pm
by TwinkiE_HunteR-G
Ok, I have GD installed, and freetype2, everythings working fine sez my phpinfo function.
But when I try this on a page all on its lonesome, it gives the error:

Warning: Could not find/open font in c:\inetpub\wwwroot\PHPTests\gd\button.php on line 8

Code: Select all

<?php
    $im = imagecreate (50, 250);
    $bgcolor = ImageColorAllocate ($im, 0x77, 0x77, 0x77);
    $color = ImageColorAllocate ($im, 0x00, 0x00, 0x00);
/* Line 8 */    ImageTTFText ($im, 35, 90, 40, 230, $color, "c:\\windows\\fonts\\fre3of9x.ttf", "test");
    Imagepng ($im, "pic1.png");
    ImageDestroy ($im);
    echo "<html><body><img src="pic.png" border=0></body></html>";
?>
I know the font is there and that is the exact filename.
The font i want to use is a barcode font, and it can be downloaded here: http://www.barcodesinc.com/free-barcode-font/

If anyone has any ideas, I would be most grateful to hear them.

- TwinkiE