将phpgraphlib图形另存为图像 [英] Save phpgraphlib graph as image

查看:92
本文介绍了将phpgraphlib图形另存为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码从SQL生成图形,而我正在使用phpgraphlib生成图形.有没有办法将此图作为图像保存到服务器上的特定位置?

My code generates graph from SQL and I am using phpgraphlib for generating the graph. Is there a way to save this graph as a image to a specific location on a server?

谢谢.

推荐答案

我从未使用过它,但是查看文档:

I've never used it, but looking at the documentation:

构造函数

PHPGraphLib ( int $width, int $height, [string $filename] )

...

如果 指定可选的文件名参数,PHPGraphLib将不会显示 到屏幕上,而是在与该目录相同的目录中创建一个.png文件 调用PHPGraphLib的脚本.

If you specify the optional filename argument, PHPGraphLib will not display to the screen, but instead create a .png file in the same directory as the script where PHPGraphLib is being called.

因此,请在构造函数中使用相关的$filename创建图形,并在调用->createGraph()时将其保存在其中.

So, create your graph with the relevant $filename in the constructor and it should save there when you call ->createGraph().

这篇关于将phpgraphlib图形另存为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆