0

I create a png image in the memory ,the code like this

rrdtool_function_graph(605,0,$graph_data_array)

when I run this

print rrdtool_function_graph(605,0,$graph_data_array)

It will show the png image. the question is ,how to convert it to the image file ,like abc.png ,with php?

feythin
  • 41
  • 7
  • Just open the file for writing (fopen) then write your data to it (fwrite) and close the file (fclose) – yent Aug 22 '12 at 11:49

1 Answers1

0

You can use PHP's fwrite to achieve that

$handle = fopen('abc.png', 'w');
fwrite($handle , rrdtool_function_graph(605,0,$graph_data_array));
fclose($handle);
Adi
  • 5,089
  • 6
  • 33
  • 47
  • thx for your advise.but when I put this(print rrdtool_function_graph(605,0,$graph_data_array)) on the php file ,it show the image in the brower.however,when I do as what you said ,it write only the 32281 in the abc.png – feythin Aug 22 '12 at 13:10
  • @SolrJ, what's "the 32281"? Also, please provide more parts of your code – Adi Aug 22 '12 at 13:21