你没有配置好gd库,建议去google搜一下或到faq找一下相关文章
解决方案 »
- php怎样使一篇日志原样输出
- discuz中的一个实例化类
- PHP Notice: session_start(): ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: Invalid argument (22) in ....
- 请教几个问题:
- 关于php中对mysql进行insert,update等操作
- 我的php二级连动菜单程序,请高手指点(本人只有这么多分数了)
- 参数值不能传递
- php空间那里最实惠?速度等得到保证!
- 如何编写论坛程序呀?
- 是什么问题啊。我的头大了不少(总是解决不了)
- 写文本文件时怎么样实现换行(最后十分)
- 不知道这个算不算PHP的BUG
$picwidth=360*2;
$pichight=200;
$pic=ImageCreate($picwidth+1,$picheight+1);
$cwhite=ImageColorAllocate($pic,255,255,255);
ImageFilledRectangle($pic,0,0,$picwidth+1,$picheight+1,$cwhite);
$cred=ImageColorAllocate($pic,255,0,0);
$cblue=ImageColorAllocate($pic,0,255,0);
$curx=0;
$cury=$picheight;
for($pt=0; $pt<$picwidth; $pt++) {
$newx=$curx+1;
$newy=($picheight/2)+(cos(deg2rad($newx))*($picheight/2));
ImageLine($pic,$curx,$cury,$newx,$newy,$cred);
$curx=$newx;
$cury=$newy;
}
$curx=0;
$cury=$picheight/2;
for($pt=0; $pt<$picwidth; $pt++) {
$newx=$curx+1;
$newy=($picheight/2)+(sin(deg2rad($newx))*($picheight/2));
ImageLine($pic,$curx,$cury,$newx,$newy,$cblue);
$curx=$newx;
$cury=$newy;
}
$cblack=ImageColorAllocate($pic,0,0,0);
ImageLine($pic,0,0,0,$picheight,$cblack);
ImageLine($pic,0,$picheight/2,$picwidth,$picheight/2,$cblack);
ImagePNG($pic,"./pngs/graph.png");
ImageDestroy($pic);
?>