Home > Backend Development > PHP Tutorial > PHP uses GD to implement color gradient example_PHP tutorial

PHP uses GD to implement color gradient example_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:52:12
Original
2348 people have browsed it

An example of how PHP uses GD to implement color gradients

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:

 ?

1

2

3

4

5

6

7

8

9

10

11

$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);

?>

1

2
3

4

5

6

8 9 10 11

$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); ?>
The rendering is as follows: I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/1009818.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1009818.htmlTechArticlePHP uses GD to implement color 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: ? 1 2 3 4 5 6 7 8 9 1...
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template