Home >Backend Development >PHP Tutorial >PHP uses GD to implement color gradient examples, phpgd gradient examples_PHP tutorial

PHP uses GD to implement color gradient examples, phpgd gradient examples_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:51:54944browse

php uses GD to implement color gradient examples, phpgd gradient examples

This article describes how php uses GD to implement color gradients. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;php
$im = imagecreate(255, 255);
$bg = imagecolorallocate($im, 0, 0, 0);
for ($i = 255; $i >= 0; $i--) {
    $color = imagecolorallocate($im, $i, $i, $i);
    imagefilledrectangle($im, 0, $i, 255, 1, $color);
}
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
&#63;>

The rendering is as follows:

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1011248.htmlTechArticlephp uses GD to implement color gradient examples, phpgd gradient examples. This example describes how php uses GD to implement color gradients. Share it with everyone for your reference. The specific implementation method is as follows: p...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn