Topic: headerio problema
Sveiki
bandau isvesti i ekrana stai toki reikaliuka
$sk1 = rand(0, 9);
$sk2 = rand(0, 9);
$sk3 = $sk1+$sk2;
$string = ' ' . $sk1 .' + '. $sk2 . ' = ';
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$center = ceil(ImageFontHeight($font)/2);
$height = ImageFontHeight($font)*2;
$im = @imagecreatetruecolor ($width,$height);
$bgcolor = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0, 0, 0);
imagestring ($im, $font, 0, $center, $string, $text_color);
imagejpeg ($im);
imagedestroy($im);
Kad php paisytu paveiksliuka reikia isvesti headeri
<? header("Content-type: image/jpg"); ?>
Jeigu headery isvedu pries
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Gaunu visiskai tuscia ekrana, t.y. Nerodo nieko
o jei koda patalpinu po eilutes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
svetaine rodo normalei bet ismeta uzrasa kad headerei jau issiusti.
ir vieto to kad sugeneruotu paveiksliuka gaunu tik
����JFIF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
��>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default ir t.t.
tai kada isiust man ta headeri reikia?
ai dar pries
yra php codas jungimosi prie duomenu bazes duomenys session_start keli ifai. bet kad ir pries ta php coda idedu i pirma eilute vistiek gaunu tusica ekrana...