设为首页 加入收藏 网站搜索 繁體中文 中国建站网 — 站长资源分享平台

PHP实现的功能是显示8条基色色带

来源:网络收集 作者:佚名 时间:2007-04-25 21:48:22
由于PHP的本色表参数只能支持256,为了能实现显示8色或更多的色带,我使用了参数传递的方法来实现。具体实现的代码如下:

1、生成色带图形的程序
transition.php
<?php
/*
*  功能:生成色带图形
*  程序员:wlxz
* 日期: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、调用生成多个不同的图形
view_color.php
<?php
/*
*  功能:
*  程序员:向黎
* 日期:2002-00-00
*/
?>
<html>
<head>
<title>  </title>
<meta name="Author" content="XIANG Li">
</head>

<body>
<table>
<tr>
    <td><!--色带1-->
    <input type="image" src="./transition.php?x=0&y=0&z=0">
    </td>
</tr>
<tr>
    <td><!--色带2-->
    <input type="image" src="./transition.php?x=0&y=0&z=1">
    </td>
</tr>
<tr>
    <td><!--色带3-->
    <input type="image" src="./transition.php?x=0&y=1&z=0">
    </td>
</tr>
<tr>
    <td><!--色带4-->
    <input type="image" src="./transition.php?x=0&y=1&z=1">
    </td>
</tr>
<tr>
    <td><!--色带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><!--色带7-->
    <input type="image" src="./transition.php?x=1&y=1&z=0">
    </td>
</tr>
<tr>
    <td><!--色带8-->
    <input type="image" src="./transition.php?x=1&y=1&z=1">
    </td>
</tr>
</table>
</body>
</html>

Tags:

  • 好的评价 如果您觉得好,就请您
      0%(0)
  • 差的评价 如果您觉得差,就请您
      0%(0)
  • 相关文章
    广告赞助

    文章随便看看 设计素材 建站学院 网页模板 视频教程

    网友评论

    共有 0 位网友发表了评论,得分 0 分,平均 0 分    查看完整评论

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 1分

    内 容:

             通知管理员 验证码: