How to make an image using PHP?

  • Thread starter Thread starter ben
  • Start date Start date
B

ben

Guest
This is kinda like my captcha. Here is the PHP coding...

<?php
session_start();
$num1 = rand(1,9);
$num2 = rand(1,9);
$num3 = rand(1,9);
$num4 = rand(1,9);
$num5 = rand(1,9);
$num6 = rand(1,9);
$captcha = $num1.$num2.$num3.$num4.$num5.$num6;
$text = $num1."-".$num2."-".$num3."-".$num4."-".$num5."-".$num6;
$_SESSION["vercode"] = $captcha;
$height = 25;
$width = 105;

$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 63, 65, 63);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;

imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
?>

That creates an image. Well, its not very secure so I made a png image with lines across everywhere. How do I make that the background of the image?

Thank you!
 
Back
Top