AW: Image per PHP mit Session-Daten erstellen
Hallo vt1816!
Vielen Dank für die rasche Antwort.
Nach wirklich zahlreichen Tests komme ich zum Ergebnis, dass die SESSION-Daten nicht in der bild.php "ankommen". Ich habe versucht, eine Text-Datei zu übergeben und in der Grafik auszugeben - hat auch nicht funktioniert.
Der Quelltest der bild.php lautet wie folgt:
<?php
session_start();
header("Content-type: image/png");
$imgWidth = '800';
$imgHeight = '500';
$diagramm = imagecreate($imgWidth, $imgHeight);
$colorWhite = imagecolorallocate($diagramm, 255, 255, 255); #Hintergrund
$colorGrey = imagecolorallocate($diagramm, 210, 210, 210);
$colorBlue = imagecolorallocate($diagramm, 0, 50, 255);
$colorblack = imagecolorallocate($diagramm, 0, 0, 0);
// @@@@@@@@@@ RAHMEN UM DAS BILD @@@@@@@@@@
imageline($diagramm, 0, 0, $imgWidth, 0, $colorblack); #oben
imageline($diagramm, $imgWidth-1, 0, $imgWidth-1, $imgHeight-1, $colorblack); #rechts
imageline($diagramm, 0, $imgHeight-1, $imgWidth, $imgHeight-1, $colorblack); #unten
imageline($diagramm, 0, 0, 0, $imgHeight, $colorblack); #links
// @@@@@@@@@@ ERSTELLEN EINES RASTERS @@@@@@@@@@
$pxRaster = '20'; #Größe des Rasters
$pxWidth = round($imgWidth / $pxRaster, 0);
for($i=1; $i<$pxWidth; $i++){
imageline($diagramm, $i*$pxRaster, 0, $i*$pxRaster, $imgHeight, $colorGrey); #vertikal
imageline($diagramm, 0, $i*$pxRaster, $imgWidth, $i*$pxRaster, $colorGrey); #horizontal
}
// @@@@@@@@@@ ZEICHNEN DES DIAGRAMMS @@@@@@@@@@
$wert = $_SESSION['Ergebnisdaten'];
$countBalken = count($wert);
for($i=0;$i<$countBalken;$i++){
if($maxHeight < $wert[$i]){
$maxHeight = $wert[$i];
}
}
$dynWidth = round(($imgWidth-2) / ($countBalken-1), 0);
@$dynHeight = ($imgHeight-1) / $maxHeight;
for ($i=0; $i<$countBalken; $i++){
$aktNewSize = @round($dynHeight * $wert[$i]);
$aktNewSize2 = @round($dynHeight * $wert[$i+1]);
if($i+1 < $countBalken){
imageline($diagramm, $i*$dynWidth, ($imgHeight-$aktNewSize),
($i+1)*$dynWidth, ($imgHeight-$aktNewSize2), $colorBlue);
}
}
// @@@@@@@@@@ AUSGABE DES BILDES @@@@@@@@@@
imagepng($diagramm); #ausgeben des Bildes als PNG
// imagedestroy($diagramm); #freigeben und zerstören des Bildes
?>
Vielen Dank für Deine Bemühungen!
Viele Grüße aus der Pfalz,
Markus
|