#This is it, the generator! Thought it would be a little more impressive huh? #Increase the right operator in the for loop to increase the number of digits #for the key. Decrease to decrease.... $int .= (0..9)[rand 10] for (1..6); my @dat = split('', $int); #This encrypts the generated string so we can pass it as a #hidden parameter and keep the true value secret. $int = crypt($int, "gen"); #This creates the html image tags. my $it = 0; for (@dat) { my $cnt = make($_, $it); $images .= "{'IMAGES_URL'}/$cnt.gif\">"; $it++; } #Return html page to browser return qq~ $Register::lang->{'reg_key'}
$images

* ~; #This is the meat and potatoes of the image generation sub make { my ($num, $it) = @_; my $image = Image::Magick->new; #Here we set path for reading images and then #read in binary image data. my $path = $iB::DAT->{'HTML_DIR'}."nums/".$num.".gif"; my $x = $image->Read($path); warn "$x" if ($x); #Sends warning if binary read was unsuccessful #Here we set path for writing images and then #write the renamed image for security reasons. my $file = $iB::DAT->{'HTML_DIR'}.$it.".gif"; $x = $image->Write($file); warn "$x" if ($x); #Sends warning if binary write was unsuccessful #This is a must to keep our module variable clean and valid undef($image); return $it; } }