Hey there!
I was thinking.. there are many users who have asked from me.. how to create a captcha or that image where are those random numbers or letters.. so i thought i'll make one..
PHP Code:
<?php
header('Content-type: image/jpg');
header('Content-type: image/jpg'); this means that it will be a jpg image (because our background will be jpg)
PHP Code:
$im = imagecreatefromjpeg ("image.jpg");
$im = imagecreatefromjpeg ("image.jpg"); It will take image.jpg for our image's background
PHP Code:
$rand1 = rand(1,255);
$rand2 = rand(1,255);
$rand3 = rand(1,255);
$color = imagecolorallocate($im, $rand1, $rand2, $rand3);
$rand1 = rand(1,255);-
$rand2 = rand(1,255);- - Those variables will create a random number from 1 to 255 so we will have a random color for our text
$rand3 = rand(1,255);-
$color = imagecolorallocate($im, $rand1, $rand2, $rand3); - This will create a color for our text
PHP Code:
$text = rand(1000, 9999);
$font = 'text-font.otf';
$size = 30;
$text = rand(1000, 9999); - This will create a random number between 1000 and 9999
$font = 'text-font.otf'; - This will be our font
$size = 30; - It will be font's size
PHP Code:
imagettftext($im, $size, 0, 70, 45, $color, $font, $text);
imagejpeg($im);
imagedestroy($im);
This will put your info together to form a image

it's that simple..
Here's the full code:
PHP Code:
<?php
header('Content-type: image/jpg');
$im = imagecreatefromjpeg ("image.jpg");
$rand1 = rand(1,255);
$rand2 = rand(1,255);
$rand3 = rand(1,255);
$color = imagecolorallocate($im, $rand1, $rand2, $rand3);
$text = rand(1000, 9999);
$font = 'text-font.otf';
$size = 30;
imagettftext($im, $size, 0, 70, 45, $color, $font, $text);
imagejpeg($im);
imagedestroy($im);
?>
I attached this script's files also

It includes text-font.oft, image.jpg and index.php files
I'll add the part 2 for it also

tomorrow i guess