盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

CGI教学:第3章 计数器的编写方法

时间:2024/9/12作者:未知来源:盾怪网教程人气:

[摘要]df=count.dat" align=absmiddle>; 其参数详细说明和使用方法详见上述下载网址。如果有必要的话,研究并修改一下其源程序可以使你生成更适合于自己需要的图象。6...
df=count.dat" align=absmiddle>;
其参数详细说明和使用方法详见上述下载网址。如果有必要的话,研究并修改一下其源程序可以使你生成更适合于自己需要的图象。
6、使用GD图形库
www Homepage Access Counter利用现有的数字图象简化了一部分的工作,其目的就是用于图形计数器。GD图形库的功能更加强大,不仅可以用于创建图形计数器,还可以生成各种统计图表,还提供了Perl接口库。GD及其衍生的程序详见本教程《动态创建图像》一章。
在下载的程序中有一个名为gddemo.c的程序演示了其使用方法,在sparke.cs.nyu.edu:8086/cgi.htm有其用于计数器的例子。下面是一个通过GD.pm调用GD图形库生成图像的Perl程序例:

#!/usr/bin/perl

use GD;

# create a new image
$im = new GD:Image(100,100);
# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# And fill it with red
$im->fill(50,50,$red);
# Convert the image to GIF and print it on standard output
print $im->gif;




关键词:CGI教学:第3章 计数器的编写办法




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版