Home > Backend Development > PHP Tutorial > php保存图片,该如何解决

php保存图片,该如何解决

WBOY
Release: 2016-06-13 12:21:38
Original
1178 people have browsed it

php保存图片
我用jpgraph生成画布,输入画布,但是把图片不能保存成功,运行程序也没有错误提示。
//用PHP画折线图
  include("E:/phpser/AppServ/jpgraph/jpgraph/jpgraph.php");
  include("E:/phpser/AppServ/jpgraph/jpgraph/jpgraph_line.php");
$datay=$pm25;
  $graph = new Graph(700,300,"auto");    //生成画布
  $graph->img->SetMargin(50,40,30,40);  //设置画布的边距
  $graph->img->SetAntiAliasing();     //设置拆线的平滑状态
  $graph->SetScale("textlin");     //设置刻度样式
  $graph->SetShadow();//创建画布阴影
  $graph->title->Set("最近24小时pm2.5值的变化");//设置标题
  $graph->title->SetFont(FF_SIMSUN,FS_BOLD);//设置标题字体
  $graph->SetMarginColor("lightblue");//设置画布的背景颜色为淡蓝色
  $graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);//设置Y轴标题的字体
  $graph->xaxis->SetPos("min");
  $graph->yaxis->HideZeroLabel();
  $graph->ygrid->SetFill(true,[email protected]',[email protected]');
  $graph->xaxis->SetTickLabels($a);
  $graph->xaxis->SetFont(FF_SIMSUN);   //设置X坐标轴的字体
  $graph->yscale->SetGrace(20);
  $p1 = new LinePlot($datay);    //创建折线图对象
  $p1->mark->SetType(MARK_FILLEDCIRCLE);    //设置数据坐标点为图形标记
  $p1->mark->SetFillColor("red");     //设置填充的颜色
  $p1->mark->SetWidth(4); //设置圆柱形标记的直径为4像素
  $p1->mark->SetColor("blue");    //设置拆线颜色为蓝色
  $p1->SetCenter();   //在X轴的各坐标点中心位置绘制拆线
  [color=#FF0000]$graph->Add($p1);    //在统计图上绘制折线
  //$graph->Stroke();   //输出图像
$graph->Stroke('C:/AppServ/www/pm25/1.jpg");
------解决思路----------------------

$graph->Stroke();   //输出图像
时有图片显示吗?
------解决思路----------------------
不懂啊,在学习,加油吧!!
------解决思路----------------------
有什么错误提示?
保存图片的路径是否可写?

------解决思路----------------------
不报错,不等于没有错
你只能跟踪进去看看是什么地方出了问题

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template