The function implemented by PHP is to display 8 base color bands

Source: Internet
Author: User

Because PHP's true color table parameters can only support 256, In order to display 8 colors or more ribbons, I used the parameter transfer method. The specific implementation code is as follows:

1. Program for generating ribbon graphics
Transition. php
<? Php
/*
* Function: generate a ribbon image
* 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 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 images
View_color.php
<? Php
/*
* Function:
* Programmer: Xiang Li
* Date: 2002-00-00
*/
?>
<Html>
<Head>
<Title> </title>
<Meta name = "Author" content = "XIANG Li">
</Head>

<Body>
<Table>
<Tr>
<Td> <! -- Ribbon 1 -->
<Input type = "image" src = "./transition. php? X = 0 & y = 0 & z = 0 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 2 -->
<Input type = "image" src = "./transition. php? X = 0 & y = 0 & z = 1 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 3 -->
<Input type = "image" src = "./transition. php? X = 0 & y = 1 & z = 0 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 4 -->
<Input type = "image" src = "./transition. php? X = 0 & y = 1 & z = 1 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 5 -->
<Input type = "image" src = "./transition. php? X = 1 & y = 0 & z = 0 ">
</Td>
</Tr>
<Tr>
<Td> <! -- 6 -->
<Input type = "image" src = "./transition. php? X = 1 & y = 0 & z = 1 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 7 -->
<Input type = "image" src = "./transition. php? X = 1 & y = 1 & z = 0 ">
</Td>
</Tr>
<Tr>
<Td> <! -- Ribbon 8 -->
<Input type = "image" src = "./transition. php? X = 1 & y = 1 & z = 1 ">
</Td>
</Tr>
</Table>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.