0
currently changed a machine application, so the barcode image no longer appears. The PHP version of this new machine is newer, I tried to change the image call but nothing happens. How could I fix?
<?php
echo "<IMG src='barras.php?num=" .$codigobarras." '>";
?>
Barcode (.php bars)
<?
Header("Content-type: image/jpeg");
$bf = 1;
$ab = 50;
if ($bf == "")
{
$tamxt = 1;
$tamxl = 3;
}
else
{
$tamxt = $bf;
$tamxl = ($bf * 2) + 1;
}
if ($ab == "")
$tamy = 50;
else
$tamy = $ab;
$aux_len = strlen($num)%2;
if ($aux_len != 0)
$aux_len = (strlen($num) + 1) / 2;
else
$aux_len = strlen($num) / 2;
$aux_tamx = ((6 * $tamxt + 4 * $tamxl) * $aux_len) + (6 * $tamxt) + $tamxl;
$im = ImageCreate($aux_tamx, $tamy);
$white = ImageColorAllocate($im,255,255,255);
$black = ImageColorAllocate($im,0,0,0);
$x = 0;
$y = 0;
function add_wt()
{
global $x, $y, $tamxt, $tamy, $white, $black, $im, $tamxl;
ImageFilledRectangle($im, $x, $y, $x + $tamxt, $y + $tamy, $white);
$x = $x + $tamxt;
}
function add_wl()
{
global $x, $y, $tamxt, $tamy, $white, $black, $im, $tamxl;
ImageFilledRectangle($im, $x, $y, $x + $tamxl, $y + $tamy, $white);
$x = $x + $tamxl;
}
function add_bt()
{
global $x, $y, $tamxt, $tamy, $white, $black, $im, $tamxl;
ImageFilledRectangle($im, $x, $y, $x + $tamxt, $y + $tamy, $black);
$x = $x + $tamxt;
}
function add_bl()
{
global $x, $y, $tamxt, $tamy, $white, $black, $im, $tamxl;
ImageFilledRectangle($im, $x, $y, $x + $tamxl, $y + $tamy, $black);
$x = $x + $tamxl;
}
function add_to_bar ($code)
{
switch ($code)
{
case '00':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '01':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '02':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '03':
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '04':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '05':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '06':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '07':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
break;
case '08':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '09':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '10':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '11':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '12':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '13':
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '14':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '15':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '16':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '17':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
break;
case '18':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '19':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '20':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '21':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '22':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '23':
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '24':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '25':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '26':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '27':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
break;
case '28':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '29':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '30':
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '31':
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '32':
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '33':
add_bl();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '34':
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '35':
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '36':
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '37':
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
break;
case '38':
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '39':
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '40':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '41':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '42':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '43':
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '44':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
break;
case '45':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '46':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
break;
case '47':
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
break;
case '48':
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '49':
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
break;
case '50':
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '51':
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '52':
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '53':
add_bl();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '54':
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '55':
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '56':
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '57':
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
break;
case '58':
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '59':
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '60':
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '61':
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '62':
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '63':
add_bt();
add_wl();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '64':
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
break;
case '65':
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '66':
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '67':
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
break;
case '68':
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '69':
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
break;
case '70':
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bl();
add_wt();
break;
case '71':
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
break;
case '72':
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wl();
break;
case '73':
add_bt();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bl();
add_wt();
break;
case '74':
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wl();
break;
case '75':
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
break;
case '76':
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bl();
add_wt();
break;
case '77':
add_bt();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wl();
break;
case '78':
add_bt();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
break;
case '79':
add_bt();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bl();
add_wt();
break;
case '80':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '81':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '82':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '83':
add_bl();
add_wl();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '84':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '85':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '86':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '87':
add_bl();
add_wt();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
break;
case '88':
add_bl();
add_wl();
add_bt();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '89':
add_bl();
add_wt();
add_bt();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '90':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '91':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '92':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '93':
add_bt();
add_wl();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '94':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
break;
case '95':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '96':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
break;
case '97':
add_bt();
add_wt();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wl();
break;
case '98':
add_bt();
add_wl();
add_bl();
add_wt();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '99':
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
add_bl();
add_wl();
add_bt();
add_wt();
break;
case '100': /* start */
add_bt();
add_wt();
add_bt();
add_wt();
break;
case '101': /* stop */
add_bl();
add_wt();
add_bt();
add_wl();
break;
}
}
add_to_bar("100"); /* Start */
for ($i = 0; $i < strlen ($num); $i = $i + 2)
{
$cod = substr ($num, $i, 2);
add_to_bar ($cod);
}
add_to_bar("101"); /* Stop */
//ImagePNG($im);
ImageJpeg($im);
imagedestroy($im);
?>
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero