Home Tutorial Php Phpgd PHP GD add text to image


Share on Google+Share on Google+
PHP GD add text to image
Posted on: October 30, 2009 at 12:00 AM
In this example we know how to add text to image in php gd.

PHP GD  Add text to Images


$im = imagecreatetruecolor(300, 300);

$w = imagesx($im);

$h = imagesy($im);

$text = imagecreatetruecolor($w, $h);

imagestring($text, 50, 50, 50, 'Hello', 0x0000FF);

imagecopymerge($im, $text, 50, 50, 50, 50, $w, $h, 1000);

header('Content-Type: image/gif');


imagedestroy ($text);



After running the program you will get the following output


Related Tags for PHP GD add text to image:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 30, 2009

Recommend the tutorial

Advertisements Advertisements