par
sacco » 08 août 2006, 16:22
mon css est externe
sachant que je fais des testes mon formatage n'est pas fait
<html>
<head>
<link href="page.css" rel="stylesheet" type="text/css">
<title>Page demande</title>
</head>
<body>
<?php
/* Récup des donnée du formulaire Page demande */
$Nbdep = $_POST['CH_Nbdep'];
$Nbfin = $_POST['CH_Nbfin'];
$Npas = $_POST['CH_pas'];
/* Tableau */
if ($Nbdep >= $Nbfin )
echo ("Votre nombre de départ est inférieur au nombre d'arrivé'");
else
$tabnombre = range ($Nbdep,$Nbfin); /* entiers compris entre */
for ($i=0;$i<count($tabnombre);$i++)
{
/* toute la fonction code barre */
$text = $tabnombre[$i];
putenv('GDFONTPATH=' . realpath('.'));
//echo realpath('.');
if(!isset($_GET['h'])) {$barcode_hauteur = 40;} else {$barcode_hauteur = $_GET['h'];}
$tab['0']=' 101000111011101'; $tab2[0]='0'; $tab3['0']=0; $tab['F']='101110111000101'; $tab2[15]='F'; $tab3['F']=15; $tab['U']='111000101010111'; $tab2[30]='U'; $tab3['U']=30;
$tab['1']=' 111010001010111'; $tab2[1]='1'; $tab3['1']=1; $tab['G']=' 101010001110111'; $tab2[16]='G'; $tab3['G']=16; $tab['V']='100011101010111'; $tab2[31]='V'; $tab3['V']=31;
$tab['2']=' 101110001010111'; $tab2[2]='2'; $tab3['2']=2; $tab['H']=' 111010100011101'; $tab2[17]='H'; $tab3['H']=17; $tab['W']='111000111010101'; $tab2[32]='W'; $tab3['W']=32;
$tab['3']=' 111011100010101'; $tab2[3]='3'; $tab3['3']=3; $tab['I']=' 101110100011101'; $tab2[18]='I'; $tab3['I']=18; $tab['X']='100010111010111'; $tab2[33]='X'; $tab3['X']=33;
$tab['4']=' 101000111010111'; $tab2[4]='4'; $tab3['4']=4; $tab['J']=' 101011100011101'; $tab2[19]='J'; $tab3['J']=19; $tab['Y']='111000101110101'; $tab2[34]='Y'; $tab3['Y']=34;
$tab['5']=' 111010001110101'; $tab2[5]='5'; $tab3['5']=5; $tab['K']=' 111010101000111'; $tab2[20]='K'; $tab3['K']=20; $tab['Z']='100011101110101'; $tab2[35]='Z'; $tab3['Z']=35;
$tab['6']=' 101110001110101'; $tab2[6]='6'; $tab3['6']=6; $tab['L']=' 101110101000111'; $tab2[21]='L'; $tab3['L']=21; $tab['-']='100010101110111'; $tab2[36]='-'; $tab3['-']=36;
$tab['7']='101000101110111'; $tab2[7]='7'; $tab3['7']=7; $tab['M']=' 111011101010001'; $tab2[22]='M'; $tab3['M']=22; $tab['.']='111000101011101'; $tab2[37]='.'; $tab3['.']=37;
$tab['8']=' 111010001011101'; $tab2[8]='8'; $tab3['8']=8; $tab['N']=' 101011101000111'; $tab2[23]='N'; $tab3['N']=23; $tab[' ']='100011101011101'; $tab2[38]=' '; $tab3[' ']=38;
$tab['9']=' 101110001011101'; $tab2[9]='9'; $tab3['9']=9; $tab['O']=' 111010111010001'; $tab2[24]='O'; $tab3['O']=24; $tab['$']='100010001000101'; $tab2[39]='$'; $tab3['$']=39;
$tab['A']=' 111010100010111'; $tab2[10]='A'; $tab3['A']=10; $tab['P']=' 101110111010001'; $tab2[25]='P'; $tab3['P']=25; $tab['/']='100010001010001'; $tab2[40]='/'; $tab3['/']=40;
$tab['B']='101110100010111'; $tab2[11]='B'; $tab3['B']=11; $tab['Q']='101010111000111'; $tab2[26]='Q'; $tab3['Q']=26; $tab['+']='100010100010001'; $tab2[41]='+'; $tab3['+']=41;
$tab['C']='111011101000101'; $tab2[12]='C'; $tab3['C']=12; $tab['R']='111010101110001'; $tab2[27]='R'; $tab3['R']=27; $tab['%']='101000100010001'; $tab2[42]='%'; $tab3['%']=42;
$tab['D']='101011100010111'; $tab2[13]='D'; $tab3['D']=13; $tab['S']='101110101110001'; $tab2[28]='S'; $tab3['S']=28;
$tab['E']='111010111000101'; $tab2[14]='E'; $tab3['E']=14; $tab['T']='101011101110001'; $tab2[29]='T'; $tab3['T']=29; $tab['*']='100010111011101';
$j=0;
$barcode= $tab['*'].'0';
foreach ( str_split( $text ) as $caractere ) {
$barcode.= $tab[$caractere].'0';
$j+=$tab3[$caractere];
}
// calcul du code de contôle
$taille_police=24;
$j=fmod($j, 43);
$barcode.=$tab[$tab2[$j]].'0';
$barcode.=$tab['*'].'0';
$text='*'.$text.'*';
//barre détermine le nombre de pixel d'une barre
//le coef est la différence de largeur entre les barres fines et les épaisse, il doit être entre 2,2 et 3
//mais vu qu'on travail avec de barres de 1 pixels les couples possibles sont
// dimension 0 1 2 3 4 5 6 7 8
$tab=array(
"barre"=>array(1, 2, 3, 4, 5, 6, 8, 9, 10),
"coef"=> array(3, 3, 3, 3, 3, 3, 3, 3, 3));
//dimension permet de sélectionner une taille (largeur) dans le tableau ci-dessus
if(!isset($_GET['L'])) {$dimension = 2; } else {$dimension = $_GET['L'];}
$barre=$tab["barre"][$dimension];
$coef=$tab["coef"][$dimension];
//le nombre total de barre : 3 barres larges pour 6 fines plus 1 barre fine d'espacement
$nbre=(3*$coef+6+1)*$barre;
//le nombre de barre d'1 pixel (avec le code de contôle et le "*" à chaque extrémité)
$barcode_longueur=strlen($barcode)*$barre;
//creation de l'image
$im = imagecreate($barcode_longueur,$barcode_hauteur);
$white = imagecolorallocate($im, 255,255,255);
$black = imagecolorallocate($im, 0,0,0);
$font_hauteur = imagefontheight( $taille_police );
$font_largeur = imagefontwidth( $taille_police );
//détermination de la hauteur des barre
$barcode_hauteur=$barcode_hauteur-$font_hauteur;
//on construit chaque barre
$xpos=0;
foreach ( str_split($barcode) as $caractere ) {
for($a=0; $a<$barre; $a++) {
if ( $caractere == 0 ) {
imageline( $im, $xpos, 0, $xpos, $barcode_hauteur, $white );
} else {
imageline( $im, $xpos, 0, $xpos, $barcode_hauteur, $black );
}
$xpos++;
}
}
//on ajoute le texte lisible en dessous
imagestring( $im, $taille_police,($barcode_longueur-$font_largeur*strlen($text))/2,$barcode_hauteur,$text,$black);
//on finalise l'image
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
echo '<table>
<tr>
<td><p>'$im'</p></td>
</tr>
</table>';
?>
et le css
Code : Tout sélectionner
table {
border-style:solid;
border-width:1px;
border-color:black;
width:50%;
}
td {
border-style:solid;
border-width:1px;
border-color:red;
width:50%;
}
mon css est externe
sachant que je fais des testes mon formatage n'est pas fait
[php]
<html>
<head>
<link href="page.css" rel="stylesheet" type="text/css">
<title>Page demande</title>
</head>
<body>
<?php
/* Récup des donnée du formulaire Page demande */
$Nbdep = $_POST['CH_Nbdep'];
$Nbfin = $_POST['CH_Nbfin'];
$Npas = $_POST['CH_pas'];
/* Tableau */
if ($Nbdep >= $Nbfin )
echo ("Votre nombre de départ est inférieur au nombre d'arrivé'");
else
$tabnombre = range ($Nbdep,$Nbfin); /* entiers compris entre */
for ($i=0;$i<count($tabnombre);$i++)
{
/* toute la fonction code barre */
$text = $tabnombre[$i];
putenv('GDFONTPATH=' . realpath('.'));
//echo realpath('.');
if(!isset($_GET['h'])) {$barcode_hauteur = 40;} else {$barcode_hauteur = $_GET['h'];}
$tab['0']=' 101000111011101'; $tab2[0]='0'; $tab3['0']=0; $tab['F']='101110111000101'; $tab2[15]='F'; $tab3['F']=15; $tab['U']='111000101010111'; $tab2[30]='U'; $tab3['U']=30;
$tab['1']=' 111010001010111'; $tab2[1]='1'; $tab3['1']=1; $tab['G']=' 101010001110111'; $tab2[16]='G'; $tab3['G']=16; $tab['V']='100011101010111'; $tab2[31]='V'; $tab3['V']=31;
$tab['2']=' 101110001010111'; $tab2[2]='2'; $tab3['2']=2; $tab['H']=' 111010100011101'; $tab2[17]='H'; $tab3['H']=17; $tab['W']='111000111010101'; $tab2[32]='W'; $tab3['W']=32;
$tab['3']=' 111011100010101'; $tab2[3]='3'; $tab3['3']=3; $tab['I']=' 101110100011101'; $tab2[18]='I'; $tab3['I']=18; $tab['X']='100010111010111'; $tab2[33]='X'; $tab3['X']=33;
$tab['4']=' 101000111010111'; $tab2[4]='4'; $tab3['4']=4; $tab['J']=' 101011100011101'; $tab2[19]='J'; $tab3['J']=19; $tab['Y']='111000101110101'; $tab2[34]='Y'; $tab3['Y']=34;
$tab['5']=' 111010001110101'; $tab2[5]='5'; $tab3['5']=5; $tab['K']=' 111010101000111'; $tab2[20]='K'; $tab3['K']=20; $tab['Z']='100011101110101'; $tab2[35]='Z'; $tab3['Z']=35;
$tab['6']=' 101110001110101'; $tab2[6]='6'; $tab3['6']=6; $tab['L']=' 101110101000111'; $tab2[21]='L'; $tab3['L']=21; $tab['-']='100010101110111'; $tab2[36]='-'; $tab3['-']=36;
$tab['7']='101000101110111'; $tab2[7]='7'; $tab3['7']=7; $tab['M']=' 111011101010001'; $tab2[22]='M'; $tab3['M']=22; $tab['.']='111000101011101'; $tab2[37]='.'; $tab3['.']=37;
$tab['8']=' 111010001011101'; $tab2[8]='8'; $tab3['8']=8; $tab['N']=' 101011101000111'; $tab2[23]='N'; $tab3['N']=23; $tab[' ']='100011101011101'; $tab2[38]=' '; $tab3[' ']=38;
$tab['9']=' 101110001011101'; $tab2[9]='9'; $tab3['9']=9; $tab['O']=' 111010111010001'; $tab2[24]='O'; $tab3['O']=24; $tab['$']='100010001000101'; $tab2[39]='$'; $tab3['$']=39;
$tab['A']=' 111010100010111'; $tab2[10]='A'; $tab3['A']=10; $tab['P']=' 101110111010001'; $tab2[25]='P'; $tab3['P']=25; $tab['/']='100010001010001'; $tab2[40]='/'; $tab3['/']=40;
$tab['B']='101110100010111'; $tab2[11]='B'; $tab3['B']=11; $tab['Q']='101010111000111'; $tab2[26]='Q'; $tab3['Q']=26; $tab['+']='100010100010001'; $tab2[41]='+'; $tab3['+']=41;
$tab['C']='111011101000101'; $tab2[12]='C'; $tab3['C']=12; $tab['R']='111010101110001'; $tab2[27]='R'; $tab3['R']=27; $tab['%']='101000100010001'; $tab2[42]='%'; $tab3['%']=42;
$tab['D']='101011100010111'; $tab2[13]='D'; $tab3['D']=13; $tab['S']='101110101110001'; $tab2[28]='S'; $tab3['S']=28;
$tab['E']='111010111000101'; $tab2[14]='E'; $tab3['E']=14; $tab['T']='101011101110001'; $tab2[29]='T'; $tab3['T']=29; $tab['*']='100010111011101';
$j=0;
$barcode= $tab['*'].'0';
foreach ( str_split( $text ) as $caractere ) {
$barcode.= $tab[$caractere].'0';
$j+=$tab3[$caractere];
}
// calcul du code de contôle
$taille_police=24;
$j=fmod($j, 43);
$barcode.=$tab[$tab2[$j]].'0';
$barcode.=$tab['*'].'0';
$text='*'.$text.'*';
//barre détermine le nombre de pixel d'une barre
//le coef est la différence de largeur entre les barres fines et les épaisse, il doit être entre 2,2 et 3
//mais vu qu'on travail avec de barres de 1 pixels les couples possibles sont
// dimension 0 1 2 3 4 5 6 7 8
$tab=array(
"barre"=>array(1, 2, 3, 4, 5, 6, 8, 9, 10),
"coef"=> array(3, 3, 3, 3, 3, 3, 3, 3, 3));
//dimension permet de sélectionner une taille (largeur) dans le tableau ci-dessus
if(!isset($_GET['L'])) {$dimension = 2; } else {$dimension = $_GET['L'];}
$barre=$tab["barre"][$dimension];
$coef=$tab["coef"][$dimension];
//le nombre total de barre : 3 barres larges pour 6 fines plus 1 barre fine d'espacement
$nbre=(3*$coef+6+1)*$barre;
//le nombre de barre d'1 pixel (avec le code de contôle et le "*" à chaque extrémité)
$barcode_longueur=strlen($barcode)*$barre;
//creation de l'image
$im = imagecreate($barcode_longueur,$barcode_hauteur);
$white = imagecolorallocate($im, 255,255,255);
$black = imagecolorallocate($im, 0,0,0);
$font_hauteur = imagefontheight( $taille_police );
$font_largeur = imagefontwidth( $taille_police );
//détermination de la hauteur des barre
$barcode_hauteur=$barcode_hauteur-$font_hauteur;
//on construit chaque barre
$xpos=0;
foreach ( str_split($barcode) as $caractere ) {
for($a=0; $a<$barre; $a++) {
if ( $caractere == 0 ) {
imageline( $im, $xpos, 0, $xpos, $barcode_hauteur, $white );
} else {
imageline( $im, $xpos, 0, $xpos, $barcode_hauteur, $black );
}
$xpos++;
}
}
//on ajoute le texte lisible en dessous
imagestring( $im, $taille_police,($barcode_longueur-$font_largeur*strlen($text))/2,$barcode_hauteur,$text,$black);
//on finalise l'image
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
echo '<table>
<tr>
<td><p>'$im'</p></td>
</tr>
</table>';
?>
[/php]
et le css
[code]
table {
border-style:solid;
border-width:1px;
border-color:black;
width:50%;
}
td {
border-style:solid;
border-width:1px;
border-color:red;
width:50%;
}
[/code]