Re: Re: generate img with fonts...
| From: | Bobo Wieland | Date: | Sat, 20 Sep 2003 11:03:37 +0000 |
| Subject: | Re: Re: generate img with fonts... | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21466@lists.php.net to get a copy of this message | ||
Thanks for your replay. But, why do I have to install freetype? As I've come
to understand you can just use the built in php functions with any server
installed font. No extra software necessary... Please enlighten me :)
.bobo dev@elstudion.com
----- Original Message -----
From: "Sek-Mun Wong" <sekmun@connectingspace.com>
To: <php-windows@lists.php.net>
Sent: Saturday, September 20, 2003 2:22 AM
Subject: [PHP-WIN] Re: generate img with fonts...
> Yes yes, you guys are hilarious but at least try to answer his question!
:)
>
> Bobo, I assume you're using Win32 and true type fonts, try this chunk of
> code:
>
> You *will* need to install freetype (www.freetype.org) and enable gd/gd2
> (depending on your version of php) extensions on your php install.
>
> ref: http://www.php.net/manual/en/function.imagettftext.php
>
> <?php
> Header("Content-type: image/jpeg");
> $outputtext = "Welcome";
> $fontfilename = "BlissIf Caps BoldItalic.ttf"; // whatever the actual
> filename is called
> $im = ImageCreate(240, 30);
> $black = ImageColorAllocate($im, 0, 0, 0);
> $white = ImageColorAllocate($im, 255, 255, 255);
> if (strpos(strtoupper($HTTP_SERVER_VARS["SERVER_SOFTWARE"]),"WIN",0)
> === false) {
> /* UNIX OS, use unix style paths and fontsize */
> $fontsize = 60;
> $fontpath = "/usr/local/apache/htdocs/fonts/";
> } else {
> /* Windows OS, use windows style paths and fontsize */
> $fontsize = 8;
> $fontpath = 'C:\\windows\fonts\\';
> }
> ImageTTFText($im, $fontsize, 0, 20, 20, $white, $fontpath. $fontfilename,
> $outputtext);
> ImageJpeg($im);
> ImageDestroy($im);
> ?>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>