Accueil > > > GÉNÉRATEUR DE CODE BARRE CODE 128B
GÉNÉRATEUR DE CODE BARRE CODE 128B
Information sur la source
Description
Bonjour, J'ai réalisé une source de réalisation de Code à Barre de type 128B. Pour cela j'ai utilisé une partie du code de FYAV sur la génération des codes à barres de type 3 de 9 et fait la conversion pour le Code à barres 128B. J'ai vérifié les codes à barres sur un lecteur de type douchette et aucun problème à ce jour. [Tuckleberry] à modifier mon code source avec quelques améliorations, certaines ont étaient ajouter mais pas toutes. Sa ne sert pas a faire 2 fois le même code ;-)
Source
- <?php
- // +======================================================+
- // | |
- // +------------------------------------------------------+
- // COPYRIGHT (C) 2006, ALL RIGHT RESERVED GALLY HOME CORP|
- // +--------------+---------------------------------------+
- // | VER & REV | 0.1 BETA |
- // +--------------+---------------------------------------+
- // | LANGUAGE | PHP4 |
- // +======================================================+
-
- // +============================+
- // | Original Version: 0.1 BETA |
- // +--------------+-------------+-------------------------+
- // | DEVELLOPER | GALLY HOME CORP |
- // +======================================================+
-
- // +============================+
- // | Modified Version: |
- // +--------------+-------------+-------------------------+
- // | DEVELLOPER | |
- // +--------------+---------------------------------------+
- // | Comments: | |
- // +--------------+ |
- // | |
- // | |
- // | |
- // +======================================================+
-
- // *********************************************************
- // *********************************************************
- // *********************************************************
-
- // RECUPERATION DES DIVERS VARIABLES.
- $CODE_TXT = isset($_GET['text']) ? $_GET['text'] : '';
- $CODE_HGT = isset($_GET['height']) ? $_GET['height'] : 80;
- $CODE_TTX = isset($_GET['write']) ? $_GET['write'] : 0;
- $CODE_LNG = isset($_GET['len']) ? $_GET['len'] : 2;
-
- // *********************************************************
- // *********************************************************
- // *********************************************************
-
- if ($CODE_TXT) {
- putenv('GDFONTPATH='.realpath('.'));
- $tab=array(); $tab2=array(); $tab3=array();
- $tab[0]='212222'; $tab2[0]='£'; $tab3['£']=0;
- $tab[1]='222122'; $tab2[1]='!'; $tab3['!']=1;
- $tab[2]='222221'; $tab2[2]='"'; $tab3['"']=2;
- $tab[3]='121223'; $tab2[3]='#'; $tab3['#']=3;
- $tab[4]='121322'; $tab2[4]='$'; $tab3['$']=4;
- $tab[5]='131222'; $tab2[5]='%'; $tab3['%']=5;
- $tab[6]='122213'; $tab2[6]='&'; $tab3['&']=6;
- $tab[7]='122312'; $tab2[7]="'"; $tab3["'"]=7;
- $tab[8]='132212'; $tab2[8]='('; $tab3['(']=8;
- $tab[9]='221213'; $tab2[9]=')'; $tab3[')']=9;
- $tab[10]='221312'; $tab2[10]='*'; $tab3['*']=10;
- $tab[11]='231212'; $tab2[11]='+'; $tab3['+']=11;
- $tab[12]='112232'; $tab2[12]=','; $tab3[',']=12;
- $tab[13]='122132'; $tab2[13]='-'; $tab3['-']=13;
- $tab[14]='122231'; $tab2[14]='.'; $tab3['.']=14;
- $tab[15]='113222'; $tab2[15]='/'; $tab3['/']=15;
- $tab[16]='123122'; $tab2[16]='0'; $tab3['0']=16;
- $tab[17]='123221'; $tab2[17]='1'; $tab3['1']=17;
- $tab[18]='223211'; $tab2[18]='2'; $tab3['2']=18;
- $tab[19]='221132'; $tab2[19]='3'; $tab3['3']=19;
- $tab[20]='221231'; $tab2[20]='4'; $tab3['4']=20;
- $tab[21]='213212'; $tab2[21]='5'; $tab3['5']=21;
- $tab[22]='223112'; $tab2[22]='6'; $tab3['6']=22;
- $tab[23]='312131'; $tab2[23]='7'; $tab3['7']=23;
- $tab[24]='311222'; $tab2[24]='8'; $tab3['8']=24;
- $tab[25]='321122'; $tab2[25]='9'; $tab3['9']=25;
- $tab[26]='321221'; $tab2[26]=':'; $tab3[':']=26;
- $tab[27]='312212'; $tab2[27]=';'; $tab3[';']=27;
- $tab[28]='322112'; $tab2[28]='<'; $tab3['<']=28;
- $tab[29]='322211'; $tab2[29]='='; $tab3['=']=29;
- $tab[30]='212123'; $tab2[30]='>'; $tab3['>']=30;
- $tab[31]='212321'; $tab2[31]='?'; $tab3['?']=31;
- $tab[32]='232121'; $tab2[32]='@'; $tab3['@']=32;
- $tab[33]='111323'; $tab2[33]='A'; $tab3['A']=33;
- $tab[34]='131123'; $tab2[34]='B'; $tab3['B']=34;
- $tab[35]='131321'; $tab2[35]='C'; $tab3['C']=35;
- $tab[36]='112313'; $tab2[36]='D'; $tab3['D']=36;
- $tab[37]='132113'; $tab2[37]='E'; $tab3['E']=37;
- $tab[38]='132311'; $tab2[38]='F'; $tab3['F']=38;
- $tab[39]='211313'; $tab2[39]='G'; $tab3['G']=39;
- $tab[40]='231113'; $tab2[40]='H'; $tab3['H']=40;
- $tab[41]='231311'; $tab2[41]='I'; $tab3['I']=41;
- $tab[42]='112133'; $tab2[42]='J'; $tab3['J']=42;
- $tab[43]='112331'; $tab2[43]='K'; $tab3['K']=43;
- $tab[44]='132131'; $tab2[44]='L'; $tab3['L']=44;
- $tab[45]='113123'; $tab2[45]='M'; $tab3['M']=45;
- $tab[46]='113321'; $tab2[46]='N'; $tab3['N']=46;
- $tab[47]='133121'; $tab2[47]='O'; $tab3['O']=47;
- $tab[48]='313121'; $tab2[48]='P'; $tab3['P']=48;
- $tab[49]='211331'; $tab2[49]='Q'; $tab3['Q']=49;
- $tab[50]='231131'; $tab2[50]='R'; $tab3['R']=50;
- $tab[51]='213113'; $tab2[51]='S'; $tab3['S']=51;
- $tab[52]='213311'; $tab2[52]='T'; $tab3['T']=52;
- $tab[53]='213131'; $tab2[53]='U'; $tab3['U']=53;
- $tab[54]='311123'; $tab2[54]='V'; $tab3['V']=54;
- $tab[55]='311321'; $tab2[55]='W'; $tab3['W']=55;
- $tab[56]='331121'; $tab2[56]='X'; $tab3['X']=56;
- $tab[57]='312113'; $tab2[57]='Y'; $tab3['Y']=57;
- $tab[58]='312311'; $tab2[58]='Z'; $tab3['Z']=58;
- $tab[59]='332111'; $tab2[59]='['; $tab3['[']=59;
- $tab[60]='314111'; $tab2[60]='\\'; $tab3['\\']=60;
- $tab[61]='221411'; $tab2[61]=']'; $tab3[']']=61;
- $tab[62]='431111'; $tab2[62]='^'; $tab3['^']=62;
- $tab[63]='111224'; $tab2[63]='_'; $tab3['_']=63;
- $tab[64]='111422'; $tab2[64]='`'; $tab3['`']=64;
- $tab[65]='121124'; $tab2[65]='a'; $tab3['a']=65;
- $tab[66]='121421'; $tab2[66]='b'; $tab3['b']=66;
- $tab[67]='141122'; $tab2[67]='c'; $tab3['c']=67;
- $tab[68]='141221'; $tab2[68]='d'; $tab3['d']=68;
- $tab[69]='112214'; $tab2[69]='e'; $tab3['e']=69;
- $tab[70]='112412'; $tab2[70]='f'; $tab3['f']=70;
- $tab[71]='122114'; $tab2[71]='g'; $tab3['g']=71;
- $tab[72]='122411'; $tab2[72]='h'; $tab3['h']=72;
- $tab[73]='142112'; $tab2[73]='i'; $tab3['i']=73;
- $tab[74]='142211'; $tab2[74]='j'; $tab3['j']=74;
- $tab[75]='241211'; $tab2[75]='k'; $tab3['k']=75;
- $tab[76]='221114'; $tab2[76]='l'; $tab3['l']=76;
- $tab[77]='413111'; $tab2[77]='m'; $tab3['m']=77;
- $tab[78]='241112'; $tab2[78]='n'; $tab3['n']=78;
- $tab[79]='134111'; $tab2[79]='o'; $tab3['o']=79;
- $tab[80]='111242'; $tab2[80]='p'; $tab3['p']=80;
- $tab[81]='121142'; $tab2[81]='q'; $tab3['q']=81;
- $tab[82]='121241'; $tab2[82]='r'; $tab3['r']=82;
- $tab[83]='114212'; $tab2[83]='s'; $tab3['s']=83;
- $tab[84]='124112'; $tab2[84]='t'; $tab3['t']=84;
- $tab[85]='124211'; $tab2[85]='u'; $tab3['u']=85;
- $tab[86]='411212'; $tab2[86]='v'; $tab3['v']=86;
- $tab[87]='421112'; $tab2[87]='w'; $tab3['w']=87;
- $tab[88]='421211'; $tab2[88]='x'; $tab3['x']=88;
- $tab[89]='212141'; $tab2[89]='y'; $tab3['y']=89;
- $tab[90]='214121'; $tab2[90]='z'; $tab3['z']=90;
- $tab[91]='412121'; $tab2[91]='{'; $tab3['{']=91;
- $tab[92]='111143'; $tab2[92]='|'; $tab3['|']=92;
- $tab[93]='111341'; $tab2[93]='}'; $tab3['}']=93;
- $tab[94]='131141'; $tab2[94]='~'; $tab3['~']=94;
- $tab[95]='114113'; $tab2[95]='del'; $tab3['del']=95;
- $tab[96]='114311'; $tab2[96]='fnc3'; $tab3['fnc3']=96;
- $tab[97]='411113'; $tab2[97]='fnc2'; $tab3['fnc2']=97;
- $tab[98]='411311'; $tab2[98]='shift'; $tab3['shift']=98;
- $tab[99]='113141'; $tab2[99]='codec'; $tab3['codec']=99;
- $tab[100]='114131'; $tab2[100]='fnc4'; $tab3['fnc4']=100;
- $tab[101]='311141'; $tab2[101]='codea'; $tab3['codea']=101;
- $tab[102]='411131'; $tab2[102]='fnc1'; $tab3['fnc1']=102;
- $tab[103]='211412'; $tab2[103]='starta'; $tab3['starta']=103;
- $tab[104]='211214'; $tab2[104]='startb'; $tab3['startb']=104;
- $tab[105]='211232'; $tab2[105]='startc'; $tab3['startc']=105;
- $tab[106]='2331112'; $tab2[106]='stop'; $tab3['stop']=106;
- $barcsum = 104;
- $barcode = $tab['104'];
- $CODE_TXT = str_replace(' ', '£', $CODE_TXT);
- $caractere = explode('¤',wordwrap($CODE_TXT, 1, '¤', 1));
- $size_cara =sizeof($caractere);
- for($i=0; $i<$size_cara; $i++) {
- $j++;
- $barcode.=$tab[$tab3[$caractere[$i]]];
- $barcsum+=$tab3[$caractere[$i]]*$j;
- }
- $barcsum = fmod($barcsum, 103);
- $barcode.= $tab[$barcsum];
- $barcode.= $tab['106'];
- $font_taille = 5;
- $barcode_longueur = 2;
- $nb=strlen($barcode);
- for($j=0; $j<$nb; $j++) {
- $barcode_longueur+=substr($barcode,$j,1)*$CODE_LNG;
- }
- $im = imagecreate($barcode_longueur-2,$CODE_HGT);
- $COL_White = imagecolorallocate($im, 255,255,255);
- $COL_Black = imagecolorallocate($im, 0,0,0);
- $font_hauteur = imagefontheight($font_taille);
- $font_largeur = imagefontwidth($font_taille);
- if ($CODE_TTX==true) {
- $CODE_HGT = $CODE_HGT-$font_hauteur;
- }
- $xpos = 0;
- $caractere = explode('¤',wordwrap($barcode, 6, '¤', 1));
- $size_cara = sizeof($caractere);
- for($i=0; $i<$size_cara; $i++) {
- $COLOR = $COL_Black;
- $nb=strlen($caractere[$i]);
- for($j=0; $j<$nb; $j++) {
- $TMP_CODE = substr($caractere[$i],$j,1);
- for($lngj=0; $lngj<$TMP_CODE*$CODE_LNG; $lngj++) {
- imageline($im, $xpos, 0, $xpos, $CODE_HGT, $COLOR);
- $xpos++;
- }
- if ($COLOR!=$COL_Black) {
- $COLOR = $COL_Black;
- }else{
- $COLOR = $COL_White;
- }
- }
- }
- if ($CODE_TTX==true) {
- $CODE_TXT = str_replace('£',' ', $CODE_TXT);
- imagestring($im,$font_taille,($barcode_longueur-$font_largeur*strlen($CODE_TXT))/2,$CODE_HGT,$CODE_TXT,$COL_Black);
- }
- header('Content-type: image/gif');
- imagegif($im);
- imagedestroy($im);
- }
- ?>
<?php
// +======================================================+
// | |
// +------------------------------------------------------+
// COPYRIGHT (C) 2006, ALL RIGHT RESERVED GALLY HOME CORP|
// +--------------+---------------------------------------+
// | VER & REV | 0.1 BETA |
// +--------------+---------------------------------------+
// | LANGUAGE | PHP4 |
// +======================================================+
// +============================+
// | Original Version: 0.1 BETA |
// +--------------+-------------+-------------------------+
// | DEVELLOPER | GALLY HOME CORP |
// +======================================================+
// +============================+
// | Modified Version: |
// +--------------+-------------+-------------------------+
// | DEVELLOPER | |
// +--------------+---------------------------------------+
// | Comments: | |
// +--------------+ |
// | |
// | |
// | |
// +======================================================+
// *********************************************************
// *********************************************************
// *********************************************************
// RECUPERATION DES DIVERS VARIABLES.
$CODE_TXT = isset($_GET['text']) ? $_GET['text'] : '';
$CODE_HGT = isset($_GET['height']) ? $_GET['height'] : 80;
$CODE_TTX = isset($_GET['write']) ? $_GET['write'] : 0;
$CODE_LNG = isset($_GET['len']) ? $_GET['len'] : 2;
// *********************************************************
// *********************************************************
// *********************************************************
if ($CODE_TXT) {
putenv('GDFONTPATH='.realpath('.'));
$tab=array(); $tab2=array(); $tab3=array();
$tab[0]='212222'; $tab2[0]='£'; $tab3['£']=0;
$tab[1]='222122'; $tab2[1]='!'; $tab3['!']=1;
$tab[2]='222221'; $tab2[2]='"'; $tab3['"']=2;
$tab[3]='121223'; $tab2[3]='#'; $tab3['#']=3;
$tab[4]='121322'; $tab2[4]='$'; $tab3['$']=4;
$tab[5]='131222'; $tab2[5]='%'; $tab3['%']=5;
$tab[6]='122213'; $tab2[6]='&'; $tab3['&']=6;
$tab[7]='122312'; $tab2[7]="'"; $tab3["'"]=7;
$tab[8]='132212'; $tab2[8]='('; $tab3['(']=8;
$tab[9]='221213'; $tab2[9]=')'; $tab3[')']=9;
$tab[10]='221312'; $tab2[10]='*'; $tab3['*']=10;
$tab[11]='231212'; $tab2[11]='+'; $tab3['+']=11;
$tab[12]='112232'; $tab2[12]=','; $tab3[',']=12;
$tab[13]='122132'; $tab2[13]='-'; $tab3['-']=13;
$tab[14]='122231'; $tab2[14]='.'; $tab3['.']=14;
$tab[15]='113222'; $tab2[15]='/'; $tab3['/']=15;
$tab[16]='123122'; $tab2[16]='0'; $tab3['0']=16;
$tab[17]='123221'; $tab2[17]='1'; $tab3['1']=17;
$tab[18]='223211'; $tab2[18]='2'; $tab3['2']=18;
$tab[19]='221132'; $tab2[19]='3'; $tab3['3']=19;
$tab[20]='221231'; $tab2[20]='4'; $tab3['4']=20;
$tab[21]='213212'; $tab2[21]='5'; $tab3['5']=21;
$tab[22]='223112'; $tab2[22]='6'; $tab3['6']=22;
$tab[23]='312131'; $tab2[23]='7'; $tab3['7']=23;
$tab[24]='311222'; $tab2[24]='8'; $tab3['8']=24;
$tab[25]='321122'; $tab2[25]='9'; $tab3['9']=25;
$tab[26]='321221'; $tab2[26]=':'; $tab3[':']=26;
$tab[27]='312212'; $tab2[27]=';'; $tab3[';']=27;
$tab[28]='322112'; $tab2[28]='<'; $tab3['<']=28;
$tab[29]='322211'; $tab2[29]='='; $tab3['=']=29;
$tab[30]='212123'; $tab2[30]='>'; $tab3['>']=30;
$tab[31]='212321'; $tab2[31]='?'; $tab3['?']=31;
$tab[32]='232121'; $tab2[32]='@'; $tab3['@']=32;
$tab[33]='111323'; $tab2[33]='A'; $tab3['A']=33;
$tab[34]='131123'; $tab2[34]='B'; $tab3['B']=34;
$tab[35]='131321'; $tab2[35]='C'; $tab3['C']=35;
$tab[36]='112313'; $tab2[36]='D'; $tab3['D']=36;
$tab[37]='132113'; $tab2[37]='E'; $tab3['E']=37;
$tab[38]='132311'; $tab2[38]='F'; $tab3['F']=38;
$tab[39]='211313'; $tab2[39]='G'; $tab3['G']=39;
$tab[40]='231113'; $tab2[40]='H'; $tab3['H']=40;
$tab[41]='231311'; $tab2[41]='I'; $tab3['I']=41;
$tab[42]='112133'; $tab2[42]='J'; $tab3['J']=42;
$tab[43]='112331'; $tab2[43]='K'; $tab3['K']=43;
$tab[44]='132131'; $tab2[44]='L'; $tab3['L']=44;
$tab[45]='113123'; $tab2[45]='M'; $tab3['M']=45;
$tab[46]='113321'; $tab2[46]='N'; $tab3['N']=46;
$tab[47]='133121'; $tab2[47]='O'; $tab3['O']=47;
$tab[48]='313121'; $tab2[48]='P'; $tab3['P']=48;
$tab[49]='211331'; $tab2[49]='Q'; $tab3['Q']=49;
$tab[50]='231131'; $tab2[50]='R'; $tab3['R']=50;
$tab[51]='213113'; $tab2[51]='S'; $tab3['S']=51;
$tab[52]='213311'; $tab2[52]='T'; $tab3['T']=52;
$tab[53]='213131'; $tab2[53]='U'; $tab3['U']=53;
$tab[54]='311123'; $tab2[54]='V'; $tab3['V']=54;
$tab[55]='311321'; $tab2[55]='W'; $tab3['W']=55;
$tab[56]='331121'; $tab2[56]='X'; $tab3['X']=56;
$tab[57]='312113'; $tab2[57]='Y'; $tab3['Y']=57;
$tab[58]='312311'; $tab2[58]='Z'; $tab3['Z']=58;
$tab[59]='332111'; $tab2[59]='['; $tab3['[']=59;
$tab[60]='314111'; $tab2[60]='\\'; $tab3['\\']=60;
$tab[61]='221411'; $tab2[61]=']'; $tab3[']']=61;
$tab[62]='431111'; $tab2[62]='^'; $tab3['^']=62;
$tab[63]='111224'; $tab2[63]='_'; $tab3['_']=63;
$tab[64]='111422'; $tab2[64]='`'; $tab3['`']=64;
$tab[65]='121124'; $tab2[65]='a'; $tab3['a']=65;
$tab[66]='121421'; $tab2[66]='b'; $tab3['b']=66;
$tab[67]='141122'; $tab2[67]='c'; $tab3['c']=67;
$tab[68]='141221'; $tab2[68]='d'; $tab3['d']=68;
$tab[69]='112214'; $tab2[69]='e'; $tab3['e']=69;
$tab[70]='112412'; $tab2[70]='f'; $tab3['f']=70;
$tab[71]='122114'; $tab2[71]='g'; $tab3['g']=71;
$tab[72]='122411'; $tab2[72]='h'; $tab3['h']=72;
$tab[73]='142112'; $tab2[73]='i'; $tab3['i']=73;
$tab[74]='142211'; $tab2[74]='j'; $tab3['j']=74;
$tab[75]='241211'; $tab2[75]='k'; $tab3['k']=75;
$tab[76]='221114'; $tab2[76]='l'; $tab3['l']=76;
$tab[77]='413111'; $tab2[77]='m'; $tab3['m']=77;
$tab[78]='241112'; $tab2[78]='n'; $tab3['n']=78;
$tab[79]='134111'; $tab2[79]='o'; $tab3['o']=79;
$tab[80]='111242'; $tab2[80]='p'; $tab3['p']=80;
$tab[81]='121142'; $tab2[81]='q'; $tab3['q']=81;
$tab[82]='121241'; $tab2[82]='r'; $tab3['r']=82;
$tab[83]='114212'; $tab2[83]='s'; $tab3['s']=83;
$tab[84]='124112'; $tab2[84]='t'; $tab3['t']=84;
$tab[85]='124211'; $tab2[85]='u'; $tab3['u']=85;
$tab[86]='411212'; $tab2[86]='v'; $tab3['v']=86;
$tab[87]='421112'; $tab2[87]='w'; $tab3['w']=87;
$tab[88]='421211'; $tab2[88]='x'; $tab3['x']=88;
$tab[89]='212141'; $tab2[89]='y'; $tab3['y']=89;
$tab[90]='214121'; $tab2[90]='z'; $tab3['z']=90;
$tab[91]='412121'; $tab2[91]='{'; $tab3['{']=91;
$tab[92]='111143'; $tab2[92]='|'; $tab3['|']=92;
$tab[93]='111341'; $tab2[93]='}'; $tab3['}']=93;
$tab[94]='131141'; $tab2[94]='~'; $tab3['~']=94;
$tab[95]='114113'; $tab2[95]='del'; $tab3['del']=95;
$tab[96]='114311'; $tab2[96]='fnc3'; $tab3['fnc3']=96;
$tab[97]='411113'; $tab2[97]='fnc2'; $tab3['fnc2']=97;
$tab[98]='411311'; $tab2[98]='shift'; $tab3['shift']=98;
$tab[99]='113141'; $tab2[99]='codec'; $tab3['codec']=99;
$tab[100]='114131'; $tab2[100]='fnc4'; $tab3['fnc4']=100;
$tab[101]='311141'; $tab2[101]='codea'; $tab3['codea']=101;
$tab[102]='411131'; $tab2[102]='fnc1'; $tab3['fnc1']=102;
$tab[103]='211412'; $tab2[103]='starta'; $tab3['starta']=103;
$tab[104]='211214'; $tab2[104]='startb'; $tab3['startb']=104;
$tab[105]='211232'; $tab2[105]='startc'; $tab3['startc']=105;
$tab[106]='2331112'; $tab2[106]='stop'; $tab3['stop']=106;
$barcsum = 104;
$barcode = $tab['104'];
$CODE_TXT = str_replace(' ', '£', $CODE_TXT);
$caractere = explode('¤',wordwrap($CODE_TXT, 1, '¤', 1));
$size_cara =sizeof($caractere);
for($i=0; $i<$size_cara; $i++) {
$j++;
$barcode.=$tab[$tab3[$caractere[$i]]];
$barcsum+=$tab3[$caractere[$i]]*$j;
}
$barcsum = fmod($barcsum, 103);
$barcode.= $tab[$barcsum];
$barcode.= $tab['106'];
$font_taille = 5;
$barcode_longueur = 2;
$nb=strlen($barcode);
for($j=0; $j<$nb; $j++) {
$barcode_longueur+=substr($barcode,$j,1)*$CODE_LNG;
}
$im = imagecreate($barcode_longueur-2,$CODE_HGT);
$COL_White = imagecolorallocate($im, 255,255,255);
$COL_Black = imagecolorallocate($im, 0,0,0);
$font_hauteur = imagefontheight($font_taille);
$font_largeur = imagefontwidth($font_taille);
if ($CODE_TTX==true) {
$CODE_HGT = $CODE_HGT-$font_hauteur;
}
$xpos = 0;
$caractere = explode('¤',wordwrap($barcode, 6, '¤', 1));
$size_cara = sizeof($caractere);
for($i=0; $i<$size_cara; $i++) {
$COLOR = $COL_Black;
$nb=strlen($caractere[$i]);
for($j=0; $j<$nb; $j++) {
$TMP_CODE = substr($caractere[$i],$j,1);
for($lngj=0; $lngj<$TMP_CODE*$CODE_LNG; $lngj++) {
imageline($im, $xpos, 0, $xpos, $CODE_HGT, $COLOR);
$xpos++;
}
if ($COLOR!=$COL_Black) {
$COLOR = $COL_Black;
}else{
$COLOR = $COL_White;
}
}
}
if ($CODE_TTX==true) {
$CODE_TXT = str_replace('£',' ', $CODE_TXT);
imagestring($im,$font_taille,($barcode_longueur-$font_largeur*strlen($CODE_TXT))/2,$CODE_HGT,$CODE_TXT,$COL_Black);
}
header('Content-type: image/gif');
imagegif($im);
imagedestroy($im);
}
?>
Conclusion
Exemple d'utilisation :
1. <img src="lenomdufichier.php?text=Code 128&len=1" alt="" /> Taille du code a barre de 1 2. <img src="lenomdufichier.php?text=Code 128&len=2&height=50" alt="" /> Hauteur du code a barre de 50 2. <img src="lenomdufichier.php?text=Code 128&len=2&height=80&write=1" alt="" /> Affichage du texte en dessous
Bonne contination a tous [GALLY HOME CORP]
Historique
- 06 août 2007 11:12:19 :
- Modification des boucles.
- 06 août 2007 11:23:02 :
- Modification des boucles.
- 09 août 2007 12:27:30 :
- Suppression d'une fonction et fusion dans une seul (Merci coucou747).
- 09 août 2007 20:21:44 :
- Suppression de la procedure de decoupage
- 09 août 2007 20:54:24 :
- Correction d'un bug sur les espaces dans le code128
- 10 août 2007 14:55:52 :
- Correction de l'affichage du texte du code à barre
- 11 août 2007 10:01:23 :
- Modification du header() avec des " au lieu de '
- 22 août 2007 19:21:29 :
- Ajout des déclarations tableaux
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Lecteur de code barre avec douchette [ par el_pecheur ]
Je cherche un moyen de lire un code barre avec une douchette rs232 en PHP5, connaitriez vous une solution ?
Lecture de code barre. [ par jeremy_r ]
Bonjour à tous!J'espère que qqn ici réussira à me dépatouiller du problème que j'ai actuellement.J'ai développé une appli de recueil de données, ceci
impression des barres codes [ par bigzo ]
bonjour tout le monde,je dois introduire un module de code barre dans un script php.j ai pu acceder a des codes php permettant de generer des codes b
Utilisation code barre [ par marycoco ]
Bonjour à tous, Je travaille actuellement sur un produit alimentaire qui va etre vendu chez Monoprix, et certaines epiceries fines Je comprends tout a
code barre 128 [ par stephsteph1 ]
Bonjour Je dois generer dans une application un code barre dans la symbologie 128. Il est par contre spécifié dans le cahier de charges, l'utilisa
remplacer un bouton par un code barre [ par astro20 ]
Bonjour,je vous explique, je suis entrain de réaliser un suivi de pièces mais on a pas le droit d'utiliser le clavier. on doit zapper un code barre po
pas de barre d'outil dans fckeditor [ par inaden ]
Bonjour, voilà, j'essaie d'intégrer fckeditor. J'ai regarder les sujet sur ce thème mais je n'ai pas trouvé de réponse à ma question. Mon code est le
lecture d'un code barre [ par totonyou2007 ]
je cherche un application php que fait la lecteur d'un code barre par un lecteur de code barre
Générer code barre 2D PDF417 [ par moumoune11 ]
Bonjour. je suis en licence proffessionnelle Traitement des données et internet. je dois réaliser un projet tutoré qui consiste à générer un code barr
Code barre- formulaire [ par abmseguin ]
Mon formulaire comprend les champs: CODE BARRE :DESIGNATION: PRIX Alors qu'il fonctionne bien lorsque je saisi le
|
Derniers Blogs
[SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko [FRAMEWORK 4] LES TASKS ET LE THREAD UI[FRAMEWORK 4] LES TASKS ET LE THREAD UI par fathi
Je viens de passer quelques temps au TechDay's et j'ai pu voir pas mal de session intéressante. Par contre une chose m'a un peu étonné lors de certaines de ces sessions qui abordaient les améliorations du framework .NET (donc le 4.5) : en gros, bea...
Cliquez pour lire la suite de l'article par fathi WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|