Re: image generation issues
| From: | David Robley | Date: | Tue, 12 Feb 2002 03:22:37 +0000 |
| Subject: | Re: image generation issues | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84347@lists.php.net to get a copy of this message | ||
In article <00ce01c1b36b$46c0d640$02646464@ade>,
adrian.murphy@2020tourism.com says...
> Hi,
> I'm using the code in the manual to draw text on a png.
> but Its not working - ImageString() works but not ImageTTFText()
> I uploaded arial.ttf from windows to fonts/ folder
> Any Ideas:
> as a side note: PNG's - any real disadvantage to using them
> instead of gifs - not withstanding the compuserve issue and
> old browsers.
>
> the code
> button.php
> <?php
> Header ("Content-type: image/png");
> $im = imagecreate (400, 30);
> $black = ImageColorAllocate ($im, 0, 0, 0);
> $white = ImageColorAllocate ($im, 255, 255, 255);
> ImageTTFText ($im, 20, 0, 10, 20, $white, "fonts/arial.ttf","Testing... Omega:
> Ω");
> ImagePng ($im);
> ImageDestroy ($im);
> ?>
> and i call it with
> <img src="button.php" border="0" alt="">
I think you will find that the font path in ImageTTFText needs to be an
absolute path, or relative to the current working directory. It certainly
isn't relative to the web root. To be absolutely certain, especially if
you are likely to call this from anywhere in your web file structure,
make the path absolute!
--
David Robley
Temporary Kiwi!