PHP GD bold text


 

PHP GD bold text

This example shows how to bold text in php gd.

This example shows how to bold text in php gd.

<?php

header('Content-type: image/png');

$image = imagecreatetruecolor(400, 30);

$red = imagecolorallocate($image, 255, 0, 0);

$grey = imagecolorallocate($image, 128, 128, 128);

$black = imagecolorallocate($image, 0, 0, 0);

imagefilledrectangle($image, 0, 0, 399, 29, $red);

$text = 'RoseIndia...';

$font = 'C:/WINNT/Fonts/arial.ttf';

imagettftext($image, 20, 0, 11, 21, $grey, $font, $text);

imagettftext($image, 20, 0, 10, 20, $black, $font, $text);

imagepng($image);

imagedestroy($image);

?>

After running the program you will get the following output

Ads