Alex,
You should either use png or jpg rather than gif.  The most common builds of
the gd library support those image formats--go to the GD Library site to
find out why.  The support of ttf fonts should be taken up with your host.

When testing whether the code in your image creation file works, use
something like
<a href=your_image_creation_file_name.php>say something wonderful here</a>
and any error messages will be displayed.  Once you've got it down pat, then
you can just swap out the line with an image tag, <img
src=your_image_creation_file_name.php>

$font="./fonts/verdana.ttf"; // the path to the font is needed if it isn't
in the same directory as the script
$im = imagecreate (400, 16);
$black = imagecolorallocate ($im, 0, 0, 0);
$white = imagecolorallocate ($im, 255, 255, 255);
imagettftext ($im, 10, 0, 10, 20, $black, $font, date('| l | F | d | Y |'));
header ("Content-type: image/png");  //header just before the imagepng call.
imagepng ($im);
imagedestroy ($im);

Hope this helps,
Hugh


----- Original Message -----
From: "Alex Shi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 1:00 PM
Subject: Re: [PHP] text to image


> forgot something....when try following script in another server I got
> 500 internal server error.
>
> <?
>   header ("Content-type: image/gif");
>   $im = imagecreate (400, 16);
>   $black = imagecolorallocate ($im, 0, 0, 0);
>   $white = imagecolorallocate ($im, 255, 255, 255);
>   imagettftext ($im, 10, 0, 10, 20, $black, "verdana.ttf", date('| l | F |
d
> | Y |'));
>   imagegif ($im);
>   imagedestroy ($im);
> ?>
>
> Alex again
>
> >
> > I got following error msg when ran it:
> >
> > <br>
> > <b>Warning</b>:  ImageTtfText: No TTF support in this PHP build in
> > <b>/home/dotkard/www/current_time.php</b> on line <b>6</b><br>
> > <br>
> > <b>Warning</b>:  ImageGif: No GIF support in this PHP build in
> > <b>/home/dotkard/www/current_time.php</b> on line <b>7</b><br>
> >
> > I checked the phpinfo but failed to find which variable I should turn
on.
> >
> > Alex
> >
> > > Alex,
> > > Easy to do what you want.  Check out the "image" functions in the php
> > > manual.  There are some font limitations, specifically dealing with
> > > alternate characters, but you'll find out what works and what doesn't
> soon
> > > enough.
> > > Hugh
> > >
> > > ----- Original Message -----
> > > From: "Alex Shi" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, February 14, 2003 10:16 AM
> > > Subject: [PHP] text to image
> > >
> > >
> > > > Hello,
> > > >
> > > > I am thinking to create php script to dynamically convert a text
> string
> > to
> > > > image. My questions are:
> > > >
> > > > 1. with a given text string, say "hello, world", is it possible to
> > > > dynamically
> > > > convert it to an image? and what php built-in functions can be
> utilized?
> > > > 2. if I want to use true-type verdana font, can I just upload the
> > windows
> > > > font file to the web server (linux) and use php to load the font?
> > > >
> > > > Thanks in advance!
> > > >
> > > > Alex Shi
> > > >
> > > >
> > > >
> > > > --
> > > > ==================================================
> > > > Cell Phone Batteries at 30-50%+ off retail prices!
> > > > http://www.pocellular.com
> > > > ==================================================
> > > > TrafficBuilder Network:
> > > > http://www.bestadv.net/index.cfm?ref=7029
> > > > ==================================================
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to