Home > Backend Development > PHP Tutorial > The function implemented by PHP is to display 8 primary color ribbons_PHP tutorial

The function implemented by PHP is to display 8 primary color ribbons_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 16:07:45
Original
1088 people have browsed it

Since PHP's natural color table parameters can only support 256, in order to display 8 or more color bands, I used the parameter passing method. The specific implementation code is as follows:

1. Program to generate ribbon graphics
transition.php
/*
* Function: Generate ribbon graphics
* Programmer: wlxz
* Date: 2002-00-00
*/

Header("Content-type: image/Png");
$im = ImageCreate(255 ,50);
$bgcolor = ImageColorAllocate($im, 0, 0, 0);

$x = trim($_GET['x']);
$y = trim( $_GET['y']);
$z = trim($_GET['z']);

for($i=0;$i<255;$i++){
        $fontcol = ImageColorAllocate($im, $i*$x, $i*$y, $i*$z);
           ImageLine($im, $i, 0, $i, 50, $fontcol);
}

ImagePng($im);
ImageDestroy($im);
?>

2. Call to generate multiple different graphics
view_color .php
/*
* Function:
* Programmer: Xiang Li
* Date: 2002-00-00
*/
?> ;




< ;/head>




    









                                                                                                                                           ;






< /tr>
















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