PHP GD Gradient Fill


 

PHP GD Gradient Fill

This example shows how display gradient fill in php gd.

This example shows how display gradient fill in php gd.

<?php

$image = ImageCreate(200, 200);

for($i=0; $i<255; $i++) {

$background_color = ImageColorAllocate($image, $i, $i, $i);

}

$text_color = ImageColorAllocate($image, 255, 255, 255);

$tekst = "Roseindia";

ImageString($image, 4, 30, 50, "$tekst", $text_color);

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

ImagePNG($image);

imagedestroy($image);

?>

 

After running the program you will get the following output

Ads