« Code QR » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications |
|||
Ligne 10 : | Ligne 10 : | ||
* marge : 4 carrés ou plus ; | * marge : 4 carrés ou plus ; | ||
* | * | ||
Utilitaire : | |||
* [[Fichier:QRCodeGui.zip]] | |||
Code QR en PHP : | Code QR en PHP : |
Version du 23 février 2017 à 17:04
Un code QR est un code à lecture optique en deux dimensions.
Un code QR possède les dimensions suivantes ; avec une augmentation par pas de 4 modules par côté :
- minimum : 21 x 21 modules
- maximum : 177 x 177 modules
Pour une bonne lecture du code QR, voici quelques éléments techniques :
- taille d'un carré : 4 points d'impression ou plus :
- pour une imprimante laser à 600 ppp, soit 14 points par millimètre, 4 points représentent 0,17 mm,
- marge : 4 carrés ou plus ;
Utilitaire :
Code QR en PHP :
- http://phpqrcode.sourceforge.net/examples/index.php?example=026
- http://seegatesite.com/how-to-build-qr-code-generator-site-with-php-qr-code-library/ : avec formulaire de saisie
Documentation
Sites :
- http://outils-web.fr/9-generateurs-de-qr-codes-en-ligne/
- http://www.qrcode.com/en/howto/ : explications techniques ;
- http://www.qrcode.com/en/howto/cell.html : taille d'un code QR ;
- http://www.qrcode.com/en/howto/code.html : l'aspect graphique, la taille du code QR ;
Installation
Pour installer le librairie PHP sur un site :
- récupérer les sources sur le site suivant :
- installer la librairie dans un dossier ; exemple ../web/lib/phpqrcode/
- tester en créant un script comme suit :
<?php include('qrlib.php'); // how to build raw content - QRCode with simple Business Card (VCard) $tempDir = "nomfichier"; // here our data $name = 'John Doe'; $phone = '(049)012-345-678'; // we building raw data $codeContents = 'BEGIN:VCARD'."\n"; $codeContents .= 'FN:'.$name."\n"; $codeContents .= 'TEL;WORK;VOICE:'.$phone."\n"; $codeContents .= 'END:VCARD'; // generating QRcode::png($codeContents, $tempDir.'025.png', QR_ECLEVEL_L, 3); // displaying echo '<img src="'.$tempDir.'025.png" />'; ?>
Autre exemple
<?php include('qrlib.php'); //include('config.php'); // how to build raw content - QRCode with detailed Business Card (VCard) $tempDir = "nomfichier"; // here our data $name = 'Philippe Nom'; $sortName = 'Nom;Philippe'; $phone = '+33 2 96 21 23 71'; $phonePrivate = '+33 9 96 21 23 71'; $phoneCell = '+33 7 96 21 23 71'; $orgName = 'Mon Entreprise'; $email = 'john.doe@monentreprise.fr'; // if not used - leave blank! $addressLabel = 'Our Office'; $addressPobox = ''; $addressExt = 'Suite 123'; $addressStreet = '7th Avenue'; $addressTown = 'New York'; $addressRegion = 'NY'; $addressPostCode = '91921-1234'; $addressCountry = 'USA'; // we building raw data $codeContents = 'BEGIN:VCARD'."\n"; $codeContents .= 'VERSION:2.1'."\n"; $codeContents .= 'N:'.$sortName."\n"; $codeContents .= 'FN:'.$name."\n"; $codeContents .= 'ORG:'.$orgName."\n"; $codeContents .= 'TEL;WORK;VOICE:'.$phone."\n"; $codeContents .= 'TEL;HOME;VOICE:'.$phonePrivate."\n"; $codeContents .= 'TEL;TYPE=cell:'.$phoneCell."\n"; $codeContents .= 'ADR;TYPE=work;'. 'LABEL="'.$addressLabel.'":' .$addressPobox.';' .$addressExt.';' .$addressStreet.';' .$addressTown.';' .$addressPostCode.';' .$addressCountry ."\n"; $codeContents .= 'EMAIL:'.$email."\n"; $codeContents .= 'END:VCARD'; // generating QRcode::png($codeContents, $tempDir.'026.png', QR_ECLEVEL_L, 3); // displaying echo '<img src="'.$tempDir.'026.png" />';
Test :