Génération d'image avec Graphviz sous php
Bonjour tout le monde comme le titre l'indique j'ai un problème dans la génération de l'image dans mon fichier "monGraphe.dot".
voici le code que j'ai utilisé :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <?php
$type="jpg";
$file="monGraphe";
if($fp=fopen($file.'.dot',"w")) {
fputs($fp,"digraph g { ");
fputs($fp,' node[fontsize="10" , shape=box , style="rounded,filled"]');
try
{
$bdd = new PDO('mysql:host=localhost;dbname=projet', 'root', '');
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
$reponse=$bdd->query('select nomtache,duree,tacheant
from contenir c , tache t , projet p
where p.id_projet=c.id_projet
and t.id_tache=c.id_tache');
while( $ligne=$reponse->fetch())
{
if( $ligne['tacheant']=="")
fputs($fp,'debut -> '.$ligne['nomtache'].';');
else
fputs($fp,"" .$ligne['tacheant']." -> " .$ligne['nomtache'].";");
}
fputs($fp,"}");
}
fclose($fp);
exec("dot -Tpng monGraphe.dot ");
echo "<img src=\"$file.$type\" alt=\"graphe des parrainage\" />";
?> |
merci pour votre aide .