tags:

views:

265

answers:

3

Hello,

I'm trying to display the example of image_graphviz Here, but it doesn't display anything in my page.

Here is my page:

test.php

       <?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(); 

?>

I think there is something wrong with the path, and then i use the absolute path which is "C:/wamp/bin/php/php5.3.0/PEAR/Image/GraphViz.php". But it doesn't work too.

Is there something wrong? Do you have any idea?

Thanks a lot.

A: 

your should try turn the error_reporting to E_ALL

i.e.

error_reporting(E_ALL);

I am pretty sure PHP encounter an error but not output it. Also as a good policy it's advice to always turn on E_ALL the error reporting level when you develop.

looking at the doc there it seems to pass the image data so make sure your don't have any space at the start of your PHP file, if you do header function won't work.

*NO_SPACE_HERE*<?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(); 

?>
RageZ
Thanks @Ragez,I tried the error_reporting, and there is no errors. I think i have installed pear image_graphviz, I have tested it in cmd. But actually it doesn't work with php. I don't know why.
garcon1986
you might want to edit the `GraphViz.php` and see what is happening there by adding some debug stuff in the file.
RageZ
@RageZ, Thanks for your advice. I tried and tried, no errors and display nothing. I'm so confused.
garcon1986
glad you managed to fix it!
RageZ
A: 

I uninstalled image_graphviz and reinstalled it. The version of image_graphviz is Image_Graphviz-1.2.1.tgz. Now when i open the test file, it generates the error:

Warning: fopen(C:\WINDOWS\Temp\gra50.tmp.svg) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\bin\php\php5.3.0\PEAR\Image\GraphViz.php on line 210

Does anyone know how to fix it? Thanks.

garcon1986
I have solved it. Actually, the path is not right.
garcon1986
A: 

you should install the GraphVIZ , check the following link i hope it is helpful for you http://www.graphviz.org/Download..php

Saad aldawood
it's alreayd fixed, thanks.
garcon1986