PrintImageFrame — Output the generated plot as one frame in a plot stream




PrintImageFrame is used to output (that is, send to the browser) a single plot in a plot stream. This function is similar to PrintImage, except that the image is preceded by MIME headers that indicate it is part of a stream. Also, after producing the plot, PrintImageFrame() changes the PHPlot object so that a new plot can be drawn using the same object.




The three functions StartStream, PrintImageFrame, and EndStream are used together to produce streaming plots. Scripts producing streaming plots must use a web server. The PHP CLI will not work, because streaming plots require HTTP headers.

PrintImageFrame resets internal flags in the PHPlot object that will result in the next plot starting with a blank background, just like the initial plot in the series. It does not change any of the plot settings.

For more on streaming plots, see Section 4.9, “Streaming Plots”.


This is a partial example showing how the 3 functions are used to produce streaming plots. See Section 4.9.3, “Streaming Plots - Example” for the complete example.

$plot = new PHPlot(640, 480);
$timestamp = microtime(TRUE);
for ($frame = 0; $frame < $n_frames; $frame++) {
    $data[] = next_row();
    time_sleep_until($timestamp += $frame_time);


This function was added in PHPlot-5.8.0. Prior releases are not able to produce streaming plots. Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.