PrintImageFrame
Prev | PHPlot Function Reference | Next

## PrintImageFrame

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

## Synopsis

    $plot->PrintImageFrame()

## Description

`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.

## Parameters

None

## Notes

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”.

## Example

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);
    ...
    $plot->SetPrintImage(False);
    $plot->StartStream();
    $timestamp = microtime(TRUE);
    for ($frame = 0; $frame < $n_frames; $frame++) {
        array_shift($data);
        $data[] = next_row();
        $plot->SetDataValues($data);
        $plot->DrawGraph();
        $plot->PrintImageFrame();
        time_sleep_until($timestamp += $frame_time);
    }
    $plot->EndStream();

## History

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

Prev | Up | Next
PrintImage | Home | RemoveCallback