AAAAAAAAAAAAAAAAAAAAAAAAA
// <p>Modified slightly for use in Phpcad by William L. Berggren 2002
// I actually had a bit of trouble getting it to work.
// Not tested on an actual scanner, but looks o.k. Text modified
// below without permission. Enter <u>alphanumeric</u> barcode in
// <u>textfield</u>. All other parameters must be entered by hand.</p>
//
// <p>PHP Barcode Image Generator v1.0 [9/28/2000]
// Copyright (C)2000 by Charles J. Scheffold - hide@address.com</p>
//
// <p>---
// UPDATE 4/6/2001 - Important Note! This script was written with the assumption
// that "register_globals = On" is defined in your PHP.INI file! It will not
// work as-is and as described unless this is set. My PHP came with this
// enabled by default, but apparently many people have turned it off. Either
// turn it on or modify the startup code to pull the CGI variables in the old
// fashioned way (from the HTTP* arrays). If you just want to use the functions
// and pass the variables yourself, well then go on with your bad self.
// ---</p>
//
// <p>This code is hereby released into the public domain.
// Use it, abuse it, just don't get caught using it for something stupid.
// The only barcode type currently supported is Code 3 of 9.</p>
// <pre>
// PARAMETERS:
// -----------
// $barcode = [required] The barcode you want to generate
//
// $width = (default=160) Width of image in pixels. The image MUST be
// wide enough to handle the length of the given value. The
// default value will probably be able to display about
// 6 digits. If you get an error message, make it wider!
//
// $height = (default=80) Height of image in pixels
//
// $text = (default=1) 0 to disable text below barcode, >=1 to enable
// </pre>
//
// <p>NOTE: If you actually intend to print the barcodes
// and scan them with a scanner, I highly recommend choosing
// JPEG with a quality of 100. Most browsers can't seem to print
// a PNG without mangling it beyond recognition.</p>
//
function barcode($image,$barcode,$scale,$x,$y)
{
$text = 1;
$width = 20+strlen($barcode)*30;
$height = 80;
$im = ImageCreate($width, $height);
$White = ImageColorAllocate($im, 255, 255, 255);
$Black = ImageColorAllocate($im, 0, 0, 0);
ImageInterLace ($im, 1);
// narrow, wide, and quiet ratio
$NRatio = 20;
$WRatio = 55;
$QRatio = 35;
$nChars = (strlen($barcode)+2) * ((6*$NRatio) + (3*$WRatio) + ($QRatio));
$Pixels = $width/$nChars;
$NBar = (int)(20 * $Pixels);
$WBar = (int)(55 * $Pixels);
$QBar = (int)(35 * $Pixels);
$ActualWidth = (($NBar*6) + ($WBar*3) + $QBar) * (strlen($barcode)+2);
$CurrentBarX = (int)(($width - $ActualWidth) / 2);
$Color = $White;
$BarcodeFull = "*" . strtoupper($barcode) . "*";
settype($BarcodeFull, "string");
if ($text != 0) {
$FontNum = 3;
$FontHeight = ImageFontHeight ($FontNum);
$FontWidth = ImageFontWidth ($FontNum);
$CenterLoc = (int)(($width-1) / 2) - (int)(($FontWidth
* strlen($BarcodeFull)) / 2);
ImageString ($im, $FontNum, $CenterLoc, $height-$FontHeight,
"$BarcodeFull", $Black);
}
for ($i = 0; $i < strlen($BarcodeFull); $i++) {
switch ($BarcodeFull[$i]) {
case 'a': $Stripecode= "011000100"; break;
case '$': $Stripecode= "010101000"; break;
case '%': $Stripecode= "000101010"; break;
case '*': $Stripecode= "010010100"; break;
case '+': $Stripecode= "010001010"; break;
case '|': $Stripecode= "010000101"; break;
case '.': $Stripecode= "110000100"; break;
case '/': $Stripecode= "010100010"; break;
case '0': $Stripecode= "000110100"; break;
case '1': $Stripecode= "100100001"; break;
case '2': $Stripecode= "001100001"; break;
case '3': $Stripecode= "101100000"; break;
case '4': $Stripecode= "000110001"; break;
case '5': $Stripecode= "100110000"; break;
case '6': $Stripecode= "001110000"; break;
case '7': $Stripecode= "000100101"; break;
case '8': $Stripecode= "100100100"; break;
case '9': $Stripecode= "001100100"; break;
case 'A': $Stripecode= "100001001"; break;
case 'B': $Stripecode= "001001001"; break;
case 'C': $Stripecode= "101001000"; break;
case 'D': $Stripecode= "000011001"; break;
case 'E': $Stripecode= "100011000"; break;
case 'F': $Stripecode= "001011000"; break;
case 'G': $Stripecode= "000001101"; break;
case 'H': $Stripecode= "100001100"; break;
case 'I': $Stripecode= "001001100"; break;
case 'J': $Stripecode= "000011100"; break;
case 'K': $Stripecode= "100000011"; break;
case 'L': $Stripecode= "001000011"; break;
case 'M': $Stripecode= "101000010"; break;
case 'N': $Stripecode= "000010011"; break;
case 'O': $Stripecode= "100010010"; break;
case 'P': $Stripecode= "001010010"; break;
case 'Q': $Stripecode= "000000111"; break;
case 'R': $Stripecode= "100000110"; break;
case 'S': $Stripecode= "001000110"; break;
case 'T': $Stripecode= "000010110"; break;
case 'U': $Stripecode= "110000001"; break;
case 'V': $Stripecode= "011000001"; break;
case 'W': $Stripecode= "111000000"; break;
case 'X': $Stripecode= "010010001"; break;
case 'Y': $Stripecode= "110010000"; break;
case 'Z': $Stripecode= "011010000"; break;
default: $Stripecode= "011000100"; break;
}
for ($n=0; $n < 9; $n++) {
if ($Color == $White) $Color = $Black;
else $Color = $White;
switch ($Stripecode[$n]) {
case '0':
ImageFilledRectangle($im, $CurrentBarX, 0, $CurrentBarX+$NBar,
$height-1-$FontHeight-2, $Color);
$CurrentBarX += $NBar;
break;
case '1':
ImageFilledRectangle($im, $CurrentBarX, 0, $CurrentBarX+$WBar,
$height-1-$FontHeight-2, $Color);
$CurrentBarX += $WBar;
break;
}
}
$Color = $White;
ImageFilledRectangle($im, $CurrentBarX, 0,$CurrentBarX+$QBar,
$height-1-$FontHeight-2, $Color);
$CurrentBarX += $QBar;
}
ImageCopy($image,$im,$x*$scale,$y*$scale,0,0,$width,$height);
ImageDestroy($im);
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ($PObj == "barcode") {
$a=fopen("./files/$pfilez", "a");
$xp = "<?php " . $PObj . "($" . "image,";
$xp .= '"' . $PTxt . '",';
$xp .= "$" . "scale," . $xx . "," . $yy . "); ?>\n";
fwrite($a, $xp );
fclose($a);
}
CCCCCCCCCCCCCCCCCCCCCCCCC
function barcode($image,$barcode,$scale,$x,$y) {}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "yes";
$dirlist= array("NA");
$lenlist= array("NA");
$txtitem="131313";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE