Thank you Keith:
I included, within the original code, the line: import_request_variables("p"); but I still get the red little x, similar when an IMG tag does not have the corresponding graphic file.
On the other hand what I did was to eliminate the form (to avoid the register globals issue) and moved all variables to image.php, so I eliminated sample.php too:
image.php now looks like this:
<?php
define (TRACE_ENABLED, false);
define (DEBUG_ENABLED, false);
require("barcode.php");
require("i25object.php");
require("c39object.php");
require("c128aobject.php");
require("c128bobject.php");
require("c128cobject.php");
$type="I25";
$output="jpeg";
$border=" ";
$drawtext="on";
$stretchtext="on";
$negative=" ";
$xres="2";
$width="560";
$height="90";
$font="2";
$barcode="154002464780333428814701010360004919";
if (isset($barcode) && strlen($barcode)>0)
{
$style = BCS_ALIGN_CENTER;
$style |= ($output == "png" ) ? BCS_IMAGE_PNG : 0;
$style |= ($output == "jpeg") ? BCS_IMAGE_JPEG : 0;
$style |= ($border == "on" ) ? BCS_BORDER : 0;
$style |= ($drawtext== "on" ) ? BCS_DRAW_TEXT : 0;
$style |= ($stretchtext== "on" ) ? BCS_STRETCH_TEXT : 0;
$style |= ($negative== "on" ) ? BCS_REVERSE_COLOR : 0;
}
if (!isset($style)) $style = BCD_DEFAULT_STYLE;
if (!isset($width)) $width = BCD_DEFAULT_WIDTH;
if (!isset($height)) $height = BCD_DEFAULT_HEIGHT;
if (!isset($xres)) $xres = BCD_DEFAULT_XRES;
if (!isset($font)) $font = BCD_DEFAULT_FONT;
switch ($type)
{
case "I25":
$obj = new I25Object($width, $height, $style, $barcode);
break;
case "C39":
$obj = new C39Object($width, $height, $style, $code);
break;
case "C128A":
$obj = new C128AObject($width, $height, $style, $code);
break;
case "C128B":
$obj = new C128BObject($width, $height, $style, $code);
break;
case "C128C":
$obj = new C128CObject($width, $height, $style, $code);
break;
default:
echo "Need bar code type ex. C39";
$obj = false;
}
if ($obj) {
$obj->SetFont($font);
$obj->DrawObject($xres);
$obj->FlushObject();
$obj->DestroyObject();
unset($obj); / clean /
}
?>
This modification works perfectly on PHP 4.1.1 and Win XP, but not on PHP 4.3.3 and Linux (the GD library is installed)
When I test the modified image.php on the Linux server, I get some binary garbage like:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
ÿÛC
My goal is to create a function in order to pass a number and then get the corresponding barcodes.
please, help!