PHP Errorz?

Status
Not open for further replies.

Thom

You can't touch this
Oct 1, 2010
1,305
386
Why is this causing an error?
PHP:
<?php
	@header("Content-Type: image/jpeg");
	//@ini_set('session.name','JSESSIONID');
	session_start();
	$enc_num = rand(0, 9999); 
	$key_num = rand(0, 24); 

	$hash_string = str_replace('O','B', str_replace('0','A', strtoupper(substr(md5($enc_num), $key_num, 5))));
	$hash_md5 = md5($hash_string);
	if(strlen($_SESSION['captcha']) != 5)
	{
		$_SESSION['reg_real_captcha'] = $hash_string;
	}
	else
	{
		$hash_string = $_SESSION['reg_real_captcha'];
	}
	$img_handle = imagecreatefromjpeg('./images/captcha.jpg');
	$text_colour = imagecolorallocate($img_handle, 0, 0, 0);
	$font_size = rand(23, 28);
	$size_array = getimagesize('./images/captcha.jpg');
	$img_w = $size_array[0];
	$img_h = $size_array[1];
	$horiz = round(($img_w/2)-((strlen($hash_string)*imagefontwidth(5))/2), 1);
	$vert = round(($img_h/2)-(imagefontheight($font_size)/2));
	$font = "./images/captcha.ttf"; 
	imagettftext($img_handle, $font_size, rand(-2, 3), rand(20, 25), rand(50, 45), $text_colour, $font, $hash_string);
	imagejpeg($img_handle);
	imagedestroy($img_handle);
?>

The imagettftext is erroring.
 
Status
Not open for further replies.

Users who are viewing this thread

Top