Re: Creating Images (.GIF) with PHP from Text?
| From: | Paonarong Buachaiyo | Date: | Mon, 16 Sep 2002 05:13:59 +0000 |
| Subject: | Re: Creating Images (.GIF) with PHP from Text? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116608@lists.php.net to get a copy of this message | ||
"Jason Caldwell" <jason@thinkingman.org> wrote in message
news:20020915033807.68895.qmail@pb1.pair.com...
> How can I create a dynamic image with PHP?
>
> Here's what I want to do; I have a counter (kinda) on my website.. and
this
> counter appears in a certain font -- which most computer systems will not
> have on their systems.
>
> So -- I want my PHP script to take a variable value; say 34,000 and save
> that as a .GIF or .JPG with a Blue Background, and White OCR A Extended
> 12point non-aliased Font. With the word "Counter: " in-front of the
value.
>
> Is this possible with PHP (I hope...!) Or, is there a *command line*
> utility out there for the Win32 platform that does this?
Yes Jason it possible if you have GD library (http://www.boutell.com/gd/) .
but i'm not sure if it had in the Win32 platform.
For the tutorial read this article
http://www.phpbuilder.com/columns/rasmus19990124.php3.
With my simple code but with unix host and use TTF font. (read another
function at http://th2.php.net/manual/en/ref.image.php)
<?PHP
header ("Content-type: image/png");
$im = imagecreate (100, 20);
$bg = imagecolorallocate ($im, 0, 0, 255);
$white = imagecolorallocate ($im, 255, 255, 255);
imagettftext ($im, 12, 0, 5, 14, $white,
"/home/your_directoty/fonts/ARIAL.TTF", "Counter:34000");
imagepng ($im);
imagedestroy ($im);
?>
PS. Yes GIF is removed from gd because of copyright protect but you can use
PNG.
?>
> Thanks
> Jason
>
>
>