public function createImageFile(Graph $graph)
    {
        $script = $this->createScript($graph);
        // var_dump($script);

        $tmp = tempnam(sys_get_temp_dir(), 'graphviz');
        if ($tmp === false) {
            throw new UnexpectedValueException('Unable to get temporary file name for graphviz script');
        }

        $ret = file_put_contents($tmp, $script, LOCK_EX);
        if ($ret === false) {
            throw new UnexpectedValueException('Unable to write graphviz script to temporary file');
        }

        $ret = 0;

        $executable = $this->getExecutable();
        system(escapeshellarg($executable) . ' -T ' . escapeshellarg($this->format) . ' ' . escapeshellarg($tmp) . ' -o ' . escapeshellarg($tmp . '.' . $this->format), $ret);
        if ($ret !== 0) {
            throw new UnexpectedValueException('Unable to invoke "' . $executable .'" to create image file (code ' . $ret . ')');
        }

        unlink($tmp);

        return $tmp . '.' . $this->format;
    }
public function createImageFile(Graph $graph)
    {
        $script = $this->createScript($graph);
        // var_dump($script);

        $tmp = tempnam(sys_get_temp_dir(), 'graphviz');
        if ($tmp === false) {
            throw new UnexpectedValueException('Unable to get temporary file name for graphviz script');
        }

        $ret = file_put_contents($tmp, $script, LOCK_EX);
        if ($ret === false) {
            throw new UnexpectedValueException('Unable to write graphviz script to temporary file');
        }

        $ret = 0;

        $executable = $this->getExecutable();
        system(escapeshellarg($executable) . ' -T ' . escapeshellarg($this->format) . ' ' . escapeshellarg($tmp) . ' -o ' . escapeshellarg($tmp . '.' . $this->format), $ret);
        if ($ret !== 0) {
            throw new UnexpectedValueException('Unable to invoke "' . $executable .'" to create image file (code ' . $ret . ')');
        }

        unlink($tmp);

        return $tmp . '.' . $this->format;
    }
public function createImageFile ( Graph $ graph ) { $ script = $ this -> createScript ( $ graph ) ; // var_dump($script); $ tmp = tempnam ( sys_get_temp_dir ( ) , 'graphviz' ) ; if ( $ tmp === false ) { throw new UnexpectedValueException ( 'Unable to get temporary file name for graphviz script' ) ; } $ ret = file_put_contents ( $ tmp , $ script , LOCK_EX ) ; if ( $ ret === false ) { throw new UnexpectedValueException ( 'Unable to write graphviz script to temporary file' ) ; } $ ret = 0 ; $ executable = $ this -> getExecutable ( ) ; system ( escapeshellarg ( $ executable ) . ' -T ' . escapeshellarg ( $ this -> format ) . ' ' . escapeshellarg ( $ tmp ) . ' -o ' . escapeshellarg ( $ tmp . '.' . $ this -> format ) , $ ret ) ; if ( $ ret !== 0 ) { throw new UnexpectedValueException ( 'Unable to invoke "' . $ executable . '" to create image file (code ' . $ ret . ')' ) ; } unlink ( $ tmp ) ; return $ tmp . '.' . $ this -> format ; }
create image file for this graph

@param Graph $graph graph to display
@return string                   filename
@throws UnexpectedValueException on error
@uses GraphViz::createScript()
create image file for this graph