TheMatrix
April 12th, 2011, 01:01 PM
So.......
I've been trying to use GD::SecurityImage on Perl. Just for a quick test, you know.
I am running it in Ubuntu with LAMPP 1.7.4.
Here is the code:
#!/usr/bin/perl -wT
use GD::SecurityImage;
use CGI;
my $str = int(rand(4598654));
# Create a normal image
my $image = GD::SecurityImage->new(width => 100,
height => 50,
lines => 20,
gd_font => 'giant');
$image->random($str);
$image->create(normal => 'rect');
my($image_data, $mime_type, $random_number) = $image->out;
print CGI->header( "image/$mime_type" );
binmode STDOUT;
print $image_data;
Taken directly from the SYNOPSIS section of the perldoc about this, with a slight modification. I have GD::SecurityImage installed. And here's the strange thing: it runs just fine from the command line, but not in a browser. In the browser it says that it could not find the module. Why is that??
I've been trying to use GD::SecurityImage on Perl. Just for a quick test, you know.
I am running it in Ubuntu with LAMPP 1.7.4.
Here is the code:
#!/usr/bin/perl -wT
use GD::SecurityImage;
use CGI;
my $str = int(rand(4598654));
# Create a normal image
my $image = GD::SecurityImage->new(width => 100,
height => 50,
lines => 20,
gd_font => 'giant');
$image->random($str);
$image->create(normal => 'rect');
my($image_data, $mime_type, $random_number) = $image->out;
print CGI->header( "image/$mime_type" );
binmode STDOUT;
print $image_data;
Taken directly from the SYNOPSIS section of the perldoc about this, with a slight modification. I have GD::SecurityImage installed. And here's the strange thing: it runs just fine from the command line, but not in a browser. In the browser it says that it could not find the module. Why is that??