PHP implementation of the function is to display 8 colors of the color belt! _php

Source: Internet
Author: User
Keywords display function implementation ribbon image src type in
Since PHP's natural table parameters can only support 256, in order to achieve the display of 8 colors or more color bands, I use the method of parameter transfer to achieve. The specific implementation code is as follows:

1, the color of the process of graphics
transition.php
/*
* Function: Generate ribbon graphic
* 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, $fontcol);
}

Imagepng ($im);
Imagedestroy ($im);
?>

2. Call to generate multiple different graphs
view_color.php
/*
function
* Programmer: To Lai
* Date: 2002-00-00
*/
?>


<title> </title>















































  • 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.