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

WBOY
Release: 2016-07-21 16:07:45
Original
1034 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>