bonjour,
je rencontre un soucis dans le comportement d'un script.
Le principe:
J'ai un script générant un graphique à l'aide de la librairie jpgraph. Une fois le graphe créé (mais non affiché ni généré), il l'enregistre dans une variable session et le reste de la page est généré. Dans cette page, une balise html <img> appelle un autre script qui récupère la variable session, la désérialise et génère l'image via un $graph->stroke.
Le résultat:
l'image n'est pas générée car jpgraph rencontre une erreur (manifestement lors du stroke() du second script). Le soucis vient du fait que si je génére ou affiche l'image avec le premier script (sans passer l'objet via une session), celle-ci s'affiche sans problème...
Voici le second script:
Le message d'erreur (sur le second script) est le suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 session_start(); include_once('jpgraph'); include_once('jpgraph_pie'); $tmp = $_SESSION['graphique']; $graphique = unserialize(serialize($tmp)); $graphique->Stroke();
Voilà, je ne sais pas si j'ai été clair dans la description du soucis...Warning: imagecolorresolvealpha(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 5720
Warning: imagecolorresolvealpha(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 5720
Warning: imagefilledpolygon(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6795
Warning: imagefilledpolygon(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6795
Warning: imagecolorresolvealpha(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 5720
Warning: imagefilledpolygon(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6795
Warning: imageline(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6758
Warning: imageline(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6758
Warning: imageline(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6758
Warning: imageline(): supplied argument is not a valid Image resource in /usr/share/php5/jpgraph/jpgraph.php on line 6758
Si quelqu'un avait une idée cela m'aiderait car là je sèche.
d'avance merci
P.S: J'ai fait un petit script qui résume la situation:
pour afficher le graph, il suffit d'appeler le script: test.php?affiche . Si on l'appelle test.php, on obtient l'erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 test.php <?php session_start(); include_once('jpgraph.php'); include_once('jpgraph_pie.php'); if(!isset($_GET['flag'])){ $graph = new PieGraph(450,300); $graph->title->Set("Test"); $donnees = array(1,2,3,4,5); $partition = new PiePlot($donnees); $graph->Add($partition); if(isset($_GET['affiche'])){ $graph->Stroke(); } else { $_SESSION['graph'] = $graph; header("Location:./tmp.php?flag"); }; } else { $gr = $_SESSION['graph']; $graph = unserialize(serialize($gr)); $graph->Stroke(); }; ?>
Partager