version 1.1, 2001/08/15 13:56:40
|
version 1.3, 2001/09/28 20:26:02
|
Line 12
|
Line 12
|
# EAN13, EAN8, UPCA, UPCE, NW7, Code39, |
# EAN13, EAN8, UPCA, UPCE, NW7, Code39, |
# ITF, IATA2of5, Matrix2of5, and COOP2of5. |
# ITF, IATA2of5, Matrix2of5, and COOP2of5. |
|
|
|
# Example usage: /cgi-bin/barcode.gif?encode=12345*31*MSUL1 |
|
|
use strict; |
use strict; |
use GD::Barcode::Code39; |
use GD::Barcode::Code39; |
|
|
Line 30 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; |