Moring everyone,
here's the problem. I've writted the code to make one of those random image verification thingys.
Everything works fine.
i generate the string and put it in the image.
but i am trying to extract the string to another variable and can't do it.
here is my function
function gen_rand_img() {
################################################################################################################################
//USER VARIABLES
$image_w = 146; //image width
$image_h = 50; //image hight
$string_l = 6; //length of string
//DO NOT EDIT BELOW THIS LINE
################################################################################################################################
//FUNCTION VARIABLES
//create the image
$im = ImageCreate($image_w, $image_h);
//set white and black
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
//generate the random string
srand((double)microtime()*1000000);
$string = md5(rand(0,9999)); // generate a random number
$new_string = substr($string, 17, $string_l); //grab string from string.
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 70, 10, $new_string, $white);
Imagepng($im, 'rand_image.png');
}
i though that by echoing the $new_string var i would get the information that is getting injected into the png file. but i get an empty variable.
Any ideas?
thanks in advance.
chris