Calling graphviz' dot or neato
is being done by Image_GraphViz implicitly
when calling
image()
or
fetch().
Both can be used to generate and display/return image data in
a large number of image formats, including
svg, png, pdf
and plain text.

TIP: The last paragraph in the example suggests that you can use this sample code to generate binary representations of the graph using the same syntax. This is a bit misleading and it isn't obvious why until you do some digging.

For example, the $gv->image() method takes an optional parameter indicating the format of the resulting image. If you dig around you will find that this parameter may be one of several character strings including 'png', 'jpg' and 'pdf'. Further, if you take the example here verbatim and add, say, 'png' as the input parameter to the image call you get no result displayed on the generated page and the reason for this is non-obvious (it just took me several hours or reading, googling, debugging, etc. to find the solution).

To make a long story short, the result returned from the call to image() is a raw data stream with a representation of the graph you are creating in the format you requested. If you specify 'png' then the return value will be a byte-stream representing the raw PNG image data.

What you need to do here is add some extra code to save this raw binary data to a temporary file and then encode some HTML in the PHP script to reference that file with an IMG tag. Here is some sample code I used with the example here: