RE: [PHP] Best way to put text on image
| From: | Jeff Lewis | Date: | Thu, 05 Jul 2001 00:48:50 +0000 |
| Subject: | RE: [PHP] Best way to put text on image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56250@lists.php.net to get a copy of this message | ||
Todd,
I'm not sure if you can write text to an existing image as I add to a new
one but here is the code I use...
$updateTime = date("F d, Y - h:ia");
$text = "New Movie Reviews @hyrum.net ".$updateTime;
$image = ImageCreate(500, 70);
$bg = ImageColorAllocate($image, 255, 255, 255);
$blue = ImageColorAllocate($image, 0, 0, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$himage=
ImageCreateFromPNG("/home/hyrum/public_html/images/topics/hyrum.png");
ImageRectangle($image, 0, 0, 500, 70, $white);
ImageCopy($image, $himage, 410, 5, 1, 1, 89, 64);
ImageString($image, 4, 0, 0, $text, $blue);
ImageString($image, 3, 0, 20, $title1, $black);
ImageString($image, 3, 0, 35, $title2, $black);
ImageString($image, 3, 0, 50, $title3, $black);
ImagePNG($image, "signature.png");
ImageDestroy($image);
So you could create a new image and copy your jpg to the new canvas or (and
preferably) someone will know if you can add text to an already existing
image...
Jeff
> -----Original Message-----
> From: Todd Cary [mailto:todd@aristesoftware.com]
> Sent: Wednesday, July 04, 2001 6:30 PM
> To: php-general@lists.php.net
> Subject: [PHP] Best way to put text on image
>
>
> If I have a JPEG image, what is the best way to put text or another
> image at a certain place using the gd library?
>
> Todd
>
> --
> Todd Cary
> Ariste Software
> todd@aristesoftware.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>