I have created a simple captcha generator, but won't show captcha-image :
index.php :
<?php
session_start();
$_SESSION['captcha'] = rand(1000, 9999);
?>
<img src="generator.inc.php" />
generator.inc.php :
<?php
session_start();
header('Content-type: image/jpeg');
$text = $_SESSION['captcha'];
$font_size = 30;
$image_width = 160;
$image_height = 50;
$image = imagecreate($image_width, $image_height);
imagecolorallocate($image, 200, 200, 200);
$font_color = imagecolorallocate($image, 20 , 20 , 20);
imagettftext($image, $font_size, 0, 15, 30, $font_color, 'BYekan.ttf', $text);
imagejpeg($image);
?>
Please tell me what am i doing wrong?
P.S :
I'm using Lamp server on Linux.