5 ) {
echo "
Module width must be between 1 and 5 pixels
";
}
elseif( $data==="" ) {
echo "Please enter data to be encoded, select symbology and press 'Ok'.
";
echo "Note: Data must be valid for the choosen encoding.";
}
elseif( $code==-1 ) {
echo "No code symbology selected.
";
}
elseif( $height < 10 || $height > 500 ) {
echo " Height must be in range [10, 500]
";
}
elseif( $scale < 0.1 || $scale > 15 ) {
echo " Scale must be in range [0.1, 15]
";
}
else {
if( $code==20 ) {
$encoder = BarcodeFactory::Create(6);
$encoder->UseExtended();
}
else {
$encoder = BarcodeFactory::Create($code);
}
$b = $backend=='EPS' ? 'PS' : $backend;
$b = substr($backend,0,5) == 'IMAGE' ? 'IMAGE' : $b;
$e = BackendFactory::Create($b,$encoder);
if( substr($backend,0,5) == 'IMAGE' ) {
if( substr($backend,5,1) == 'J' )
$e->SetImgFormat('JPEG');
}
if( $e ) {
if( $backend == 'EPS' )
$e->SetEPS();
if( $pswidth!='' )
$modwidth = $pswidth;
$e->SetModuleWidth($modwidth);
$e->AddChecksum($checksum);
$e->NoText($notext);
$e->SetScale($scale);
$e->SetVertical($vertical);
$e->ShowFrame($showframe);
$e->SetHeight($height);
$r = $e->Stroke($data,$file,$info,$info);
if( $r )
echo nl2br(htmlspecialchars($r));
if( $file != '' )
echo "Wrote file $file.";
}
else
echo "
Can't create choosen backend: $backend.
";
}
?>