PHP GD Outline Text


 

PHP GD Outline Text

This example shows how to draw an outline text in php gd.

This example shows how to draw an outline text in php gd.

<html>

<body>

<?php

$im = imagecreate(320, 200);

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

$white = imagecolorallocate($im, 255, 255, 255);

$blue = imagecolorallocate($im, 24, 40, 80);

imagefilledrectangle($im, 0, 0, 319, 199, $white);

imagerectangle($im, 0, 0, 250, 199, $black);

 

imagefilledrectangle($im, 2, 20, 40, 160, $blue);

imagefilledrectangle($im, 42, 60, 80, 160, $blue);

imagefilledrectangle($im, 82, 100, 120, 160, $blue);

imagefilledrectangle($im, 122, 80, 160, 160, $blue);

imagefilledrectangle($im, 162, 10, 200, 160, $blue);

imagefilledrectangle($im, 202, 40, 240, 160, $blue);

 

imagestringup($im, 5, 15, 195, "Op1", $black);

imagestringup($im, 5, 55, 195, "Op2", $black);

imagestringup($im, 5, 95, 195, "Op3", $black);

imagestringup($im, 5, 135, 195, "Op4", $black);

imagestringup($im, 5, 175, 195, "Op5", $black);

imagestringup($im, 5, 215, 195, "Op6", $black);

imagepng($im,'image.png');

imagedestroy($im);

?>

<img src="image.png" width="320" height="200">

</body>

</html>

After running the program you will get the following output

Ads