version 1.2, 2001/08/15 14:03:15
|
version 1.4, 2001/10/02 12:50:49
|
Line 3
|
Line 3
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# Scott Harrison |
# Scott Harrison |
# YEAR=2001 |
# YEAR=2001 |
# 8/15 |
# 8/15,9/28 |
|
|
# A CGI script that dynamically outputs a barcode. |
# A CGI script that dynamically outputs a barcode. |
|
|
Line 32 Content-type: image/gif
|
Line 32 Content-type: image/gif
|
|
|
END |
END |
|
|
|
unless(defined($ENV{'form.encode'}) and length($ENV{'form.encode'})) { |
|
$ENV{'form.encode'}='***ERROR***UNDEFINED***'; |
|
} |
|
|
my $oGdBar=GD::Barcode::Code39->new($ENV{'form.encode'}); |
my $oGdBar=GD::Barcode::Code39->new($ENV{'form.encode'}); |
warn($GD::Barcode::errStr); |
if ($GD::Barcode::errStr or !defined($oGdBar)) { |
|
warn($GD::Barcode::errStr); |
|
$oGdBar=GD::Barcode::Code39->new('***ERROR***INVALID***'); |
|
} |
my $bindata=$oGdBar->plot->png; # create barcode image |
my $bindata=$oGdBar->plot->png; # create barcode image |
undef $oGdBar; |
undef $oGdBar; |
binmode(STDOUT); |
binmode(STDOUT); |
open OUT,"|pngtopnm|ppmtogif"; # convert into a gif image |
open OUT,"|pngtopnm|ppmtogif 2>/dev/null"; # convert into gif image |
print OUT $bindata; # output image |
print OUT $bindata; # output image |
$|=1; # be sure to flush before closing |
$|=1; # be sure to flush before closing |
close OUT; |
close OUT; |