Search code examples
phpsvgpeargraphviz

image display in pear php prahpviz digraph example


I have tried the simple graphviz digraph example presented on this site --> http://pear.php.net/manual/en/package.images.image-graphviz.example.php

I am relatively new to web development, so I have a feeling that my problem is on par with not having the computer plugged in ... but here goes

I have placed this code from the above website in the middle of a web page:

  <?php
    require_once 'Image/GraphViz.php';

    $gv = new Image_GraphViz();
    $gv->addEdge(array('wake up'        => 'visit bathroom'));
    $gv->addEdge(array('visit bathroom' => 'make coffee'));
    $gv->image();
  ?> 

No image. I ran unit tests packaged with the Image_Graphviz package, and I replaced the line "$gv->image();" with "echo $gv->parse();" and it is clear the script is getting invoked, and that the script is generating the proper structures. What do I need to do to have it display? Do I need to install another SVG kind of package, or what? I know the answer must be really basic, but this is all pretty new to me.

Thanks


Solution

  • As the documentation states:

    Calling graphviz' dot or neato is being done by Image_GraphViz implicitly when calling image() or fetch().

    You need to have the "dot" binary installed (graphviz package).