czesc,
nie mam pojecia gdzie jest blad, moze mi pomozecie?
otoz gdy wywoluje taki kod:
$name = $_GET['application'];
$text = rand(10000
,99999
); $_SESSION['application'][$name] = $text;
$height = 25;
$width = 65;
$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;
imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
z adresu
http://localhost/image.php?application=first
wszystko jest OK, gdy zmienie ten kod na:
if (isset($_GET['application']) && !empty($_GET['application'])) { if (isset($_GET['image']) && $_GET['image'] == 'get'){ $name = $_GET['application'];
$text = rand(10000
,99999
); $_SESSION['application'][$name] = $text;
$height = 25;
$width = 65;
$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;
imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
}
}
wtedy do przegladarki zwracany jest format RAW obrazka, wiec dodaje przed linia header
header('Content-type: image/jpeg'); imagejpeg($image_p, null, 80);
i dostaje wtedy informacje ze obrazek zawiera bledy. Gdy go skopiuje na dysk to otwiera sie (irfanView) bez zadnego problemu. Dodam tylko ze probowalem ob_start() ale tez nie dalo to zadnego rezultatu.
gdzie mam blad Panowie?