Ajout de la recherche OpenSearch

Possibilité de générer un code QR depuis la barre de recherche, en
ajoutant le générateur comme moteur de recherche.
This commit is contained in:
Miraty 2019-03-17 16:03:43 +01:00
parent 9ce259cfa0
commit 8a2a605f45
22 changed files with 2632 additions and 2043 deletions

100
index.php
View File

@ -3,15 +3,8 @@
https://code.antopie.org/miraty/qr
-->
<?php
supprimerVieuxQR(60 * 60 * 24 * 7); // Indique le temps en secondes après lequel le code qr sera supprimé quand qq chargera la page
$theme = "defaut"; // defaut ou parinux
if ($theme == "defaut") {
$couleurPrincipale = "#2D2F34";
} else if ($theme == "parinux") {
$couleurPrincipale = "#157097";
}
require "options.inc.php";
?>
@ -34,14 +27,19 @@
<link rel="icon" type="image/png" href="favicons/<?php echo $theme; ?>-512.png" sizes="512x512"/>
<meta name="theme-color" content="<?php echo $couleurPrincipale; ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="search" type="application/opensearchdescription+xml" title="Générer un code QR" href="opensearch.php" />
<style>
<?php require("lessphp/lessc.inc.php");
<?php require "lessphp/lessc.inc.php";
$less = new lessc;
echo $less->compileFile("themes/" . $theme . ".less"); ?>
</style>
</head>
<body lang="fr">
<?php if (!isset($_GET["texte"])) { // Si OpenSearch n'a pas été utilisé ?>
<header>
<a href=""><img id="logo" src="<?php echo $theme; ?>.png" alt="Logo <?php echo $theme; ?>"> <h1>Générateur de codes QR</h1></a>
</header>
@ -49,6 +47,10 @@
<div class="param">
<label for="texte">Texte à encoder</label>
<span class="conteneurAide">
<img src="aide.svg" alt="Aide">
<span class="contenuAide">Vous pouvez encoder ce que vous voulez sous forme de texte.</span>
</span>
<br>
<textarea rows="8" required="" id="texte" placeholder="Entrez le texte à encoder dans le code QR" name="texte"><?php
@ -128,32 +130,21 @@
</form>
<?php
function generateRandomString($length) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
<?php
if (isset($_POST['texte']) and isset($_POST['taille']) and isset($_POST['redondance']) and isset($_POST['marge'])) {
include "phpqrcode/qrlib.php";
require "phpqrcode/qrlib.php";
$cheminImage = "temp/" . generateRandomString(50) . ".png";
QRcode::png($_POST['texte'], $cheminImage, $_POST['redondance'], $_POST['taille'], $_POST['marge']); ?>
<div class="centrer">
<a href="<?php echo $cheminImage; ?>" class="bouton" download="<?php echo $_POST['texte']; ?>.png">Télécharger ce code QR</a>
<a href="<?php echo $cheminImage; ?>" class="bouton" download="<?php echo htmlspecialchars($_POST['texte']); ?>.png">Télécharger ce code QR</a>
</div>
<br><br>
<div class="centrer">
<a href="<?php echo $cheminImage; ?>"><img id="codeQR" src="<?php echo $cheminImage; ?>"/></a>
<a href="<?php echo $cheminImage; ?>"><img alt='Un code QR contenant "<?php echo htmlspecialchars($_GET['texte']); ?>"' id="codeQR" src="<?php echo $cheminImage; ?>"/></a>
</div>
<?php
}
@ -163,37 +154,32 @@
<a class="lienCodeSource" href="https://code.antopie.org/miraty/qr">Code source</a>
</footer>
<?php } else if (isset($_GET["texte"])) { // Si OpenSearch a été utilisé
if (empty($_GET["texte"])) { // Si rien n'a été recherché ?>
<span style="font-size: 30px;">Erreur : vous ne pouvez pas générer un code QR vide !
<?php } else if (!empty($_GET["texte"])) {
require "phpqrcode/qrlib.php";
$cheminImage = "temp/" . generateRandomString(50) . ".png";
QRcode::png($_GET['texte'], $cheminImage, "H", 4, 2); ?>
<div class="centrer">
<a href="<?php echo $cheminImage; ?>" class="bouton" download="<?php echo htmlspecialchars($_GET['texte']); ?>.png">Télécharger ce code QR</a>
</div>
<br><br>
<div class="centrer">
<a href="<?php echo $cheminImage; ?>"><img alt='Un code QR contenant "<?php echo htmlspecialchars($_GET['texte']); ?>"' id="codeQR" src="<?php echo $cheminImage; ?>"/></a>
</div>
<?php } } ?>
</body>
<?php
function supprimerVieuxQR($tempsDeSuppression) {
$listeCodesQR = new DirectoryIterator("temp");
foreach($listeCodesQR as $listeCodesQR) {
if ($listeCodesQR->getFilename() != "." AND $listeCodesQR->getFilename() != "..") {
if ((time() - filemtime("temp/" . $listeCodesQR->getFilename())) > $tempsDeSuppression) {
unlink("temp/" . $listeCodesQR->getFilename());
}
}
}
}
?>
</html>

21
opensearch.php Executable file
View File

@ -0,0 +1,21 @@
<?php
require "options.inc.php";
?>
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Générer un code QR</ShortName>
<Description>Générez des codes QR depuis votre barre de recherche ou d'adresse</Description>
<Image height="16" width="16" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-16.png</Image>
<Image height="32" width="32" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-32.png</Image>
<Image height="48" width="48" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-48.png</Image>
<Image height="64" width="64" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-64.png</Image>
<Image height="96" width="96" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-96.png</Image>
<Image height="128" width="128" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-128.png</Image>
<Image height="192" width="192" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-192.png</Image>
<Image height="256" width="256" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-256.png</Image>
<Image height="384" width="384" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-384.png</Image>
<Image height="512" width="512" type="image/png"><?php echo $cheminInstall; ?>favicons/<?php echo $theme; ?>-512.png</Image>
<Language>fr</Language>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" template="<?php echo $cheminInstall; ?>?texte={searchTerms}"/>
</OpenSearchDescription>

37
options.inc.php Executable file
View File

@ -0,0 +1,37 @@
<?php
supprimerVieuxQR(60 * 60 * 24 * 7); // Indique le temps en secondes après lequel le code qr sera supprimé quand qq chargera la page
$theme = "defaut"; // defaut ou parinux
if ($theme == "defaut") {
$couleurPrincipale = "#2D2F34";
} else if ($theme == "parinux") {
$couleurPrincipale = "#157097";
}
$cheminInstall = "http://localhost:8888/qr/";
function generateRandomString($length) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
function supprimerVieuxQR($tempsDeSuppression) {
$listeCodesQR = new DirectoryIterator("temp");
foreach($listeCodesQR as $listeCodesQR) {
if ($listeCodesQR->getFilename() != "." AND $listeCodesQR->getFilename() != "..") {
if ((time() - filemtime("temp/" . $listeCodesQR->getFilename())) > $tempsDeSuppression) { // Si le temps actuel (en heure Posix) moins la date de dernière modification de l'image est supérieur à la durée de vie demandée de l'image
unlink("temp/" . $listeCodesQR->getFilename()); // Alors supprimer cette image
}
}
}
}
?>

2
phpqrcode/.gitignore vendored Executable file
View File

@ -0,0 +1,2 @@
.idea/
temp/*.png

View File

@ -18,7 +18,7 @@ provided comments and project wiki page (links in README file)
Notice: probably you should'nt use all of this in same script :)
<?phpb
<?php
//include only that one, rest required files will be included from it
include "qrlib.php"

View File

@ -1,6 +1,22 @@
This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.
== UPDATE ==
Added support for eps export
Usage : QRcode::eps('arguments');
Added support for SVG export
Usage : QRcode::svg('arguments');
Added support for color export :
example :
$back_color = 0xFFFF00;
$fore_color = 0xFF00FF;
QRcode::png('some othertext 1234', false, 'h', 20, 1, false, $back_color, $fore_color);
Copyright (C) 2012 by Alexandre Assouad
== LICENSING ==
Copyright (C) 2010 by Dominik Dzienia

View File

@ -1,94 +0,0 @@
<?php
/*
* PHP QR Code encoder
*
* Exemplatory usage
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
echo "<h1>PHP QR Code</h1><hr/>";
//set it to writable location, a place for temp generated PNG files
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
//html PNG location prefix
$PNG_WEB_DIR = 'temp/';
include "qrlib.php";
//ofcourse we need rights to create temp dir
if (!file_exists($PNG_TEMP_DIR))
mkdir($PNG_TEMP_DIR);
$filename = $PNG_TEMP_DIR.'test.png';
//processing form input
//remember to sanitize user input in real-life solution !!!
$errorCorrectionLevel = 'L';
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
$errorCorrectionLevel = $_REQUEST['level'];
$matrixPointSize = 4;
if (isset($_REQUEST['size']))
$matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
if (isset($_REQUEST['data'])) {
//it's very important!
if (trim($_REQUEST['data']) == '')
die('data cannot be empty! <a href="?">back</a>');
// user data
$filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
} else {
//default data
echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>';
QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);
}
//display generated file
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
//config form
echo '<form action="index.php" method="post">
Data:&nbsp;<input name="data" value="'.(isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):'PHP QR Code :)').'" />&nbsp;
ECC:&nbsp;<select name="level">
<option value="L"'.(($errorCorrectionLevel=='L')?' selected':'').'>L - smallest</option>
<option value="M"'.(($errorCorrectionLevel=='M')?' selected':'').'>M</option>
<option value="Q"'.(($errorCorrectionLevel=='Q')?' selected':'').'>Q</option>
<option value="H"'.(($errorCorrectionLevel=='H')?' selected':'').'>H - best</option>
</select>&nbsp;
Size:&nbsp;<select name="size">';
for($i=1;$i<=10;$i++)
echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>';
echo '</select>&nbsp;
<input type="submit" value="GENERATE"></form><hr/>';
// benchmark
QRtools::timeBenchmark();

View File

@ -6,14 +6,15 @@
* This file contains MERGED version of PHP QR Code library.
* It was auto-generated from full version for your convenience.
*
* This merged version was configured to not requre any external files,
* with disabled cache, error loging and weker but faster mask matching.
* This merged version was configured to not require any external files,
* with disabled cache, error logging and weaker but faster mask matching.
* If you need tune it up please use non-merged version.
*
* For full version, documentation, examples of use please visit:
*
* http://phpqrcode.sourceforge.net/
* https://sourceforge.net/projects/phpqrcode/
* https://github.com/t0k4rt/phpqrcode
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
@ -297,6 +298,19 @@
</table>';
}
public static function save($content, $filename_path)
{
try {
$handle = fopen($filename_path, "w");
fwrite($handle, $content);
fclose($handle);
return true;
} catch (Exception $e) {
echo 'Exception reçue : ', $e->getMessage(), "\n";
}
}
}
//##########################################################################
@ -938,9 +952,9 @@
class QRimage {
//----------------------------------------------------------------------
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
{
$image = self::image($frame, $pixelPerPoint, $outerFrame);
$image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
if ($filename === false) {
Header("Content-type: image/png");
@ -974,7 +988,7 @@
}
//----------------------------------------------------------------------
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$h = count($frame);
$w = strlen($frame[0]);
@ -984,8 +998,20 @@
$base_image =ImageCreate($imgW, $imgH);
$col[0] = ImageColorAllocate($base_image,255,255,255);
$col[1] = ImageColorAllocate($base_image,0,0,0);
// convert a hexadecimal color code into decimal format (red = 255 0 0, green = 0 255 0, blue = 0 0 255)
$r1 = round((($fore_color & 0xFF0000) >> 16), 5);
$g1 = round((($fore_color & 0x00FF00) >> 8), 5);
$b1 = round(($fore_color & 0x0000FF), 5);
// convert a hexadecimal color code into decimal format (red = 255 0 0, green = 0 255 0, blue = 0 0 255)
$r2 = round((($back_color & 0xFF0000) >> 16), 5);
$g2 = round((($back_color & 0x00FF00) >> 8), 5);
$b2 = round(($back_color & 0x0000FF), 5);
$col[0] = ImageColorAllocate($base_image, $r2, $g2, $b2);
$col[1] = ImageColorAllocate($base_image, $r1, $g1, $b1);
imagefill($base_image, 0, 0, $col[0]);
@ -1007,6 +1033,7 @@
//---- qrinput.php -----------------------------
@ -1058,7 +1085,6 @@
if(!QRinput::check($mode, $size, $setData)) {
throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
return null;
}
$this->mode = $mode;
@ -1296,7 +1322,6 @@
{
if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
throw new Exception('Invalid version no');
return NULL;
}
$this->version = $version;
@ -1633,7 +1658,6 @@
$ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
if($ver < 0) {
throw new Exception('WRONG VERSION');
return -1;
} else if($ver > $this->getVersion()) {
$this->setVersion($ver);
} else {
@ -2123,7 +2147,7 @@
if($ret < 0)
return -1;
return $run;
return $ret;
}
//----------------------------------------------------------------------
@ -2195,7 +2219,7 @@
case QR_MODE_NUM: $length = $this->eatNum(); break;
case QR_MODE_AN: $length = $this->eatAn(); break;
case QR_MODE_KANJI:
if ($hint == QR_MODE_KANJI)
if ($mode == QR_MODE_KANJI)
$length = $this->eatKanji();
else $length = $this->eat8();
break;
@ -2217,7 +2241,7 @@
$p = 0;
while ($p<$stringLen) {
$mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
$mode = self::identifyMode(substr($this->dataStr, $p));
if($mode == QR_MODE_KANJI) {
$p += 2;
} else {
@ -3051,7 +3075,7 @@
//----------------------------------------------------------------------
public function encodeString8bit($string, $version, $level)
{
if(string == NULL) {
if($string == NULL) {
throw new Exception('empty string!');
return NULL;
}
@ -3088,9 +3112,9 @@
}
//----------------------------------------------------------------------
public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false)
public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$enc = QRencode::factory($level, $size, $margin);
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
return $enc->encodePNG($text, $outfile, $saveandprint=false);
}
@ -3101,6 +3125,20 @@
return $enc->encode($text, $outfile);
}
//----------------------------------------------------------------------
public static function eps($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color, $cmyk);
return $enc->encodeEPS($text, $outfile, $saveandprint=false);
}
//----------------------------------------------------------------------
public static function svg($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
return $enc->encodeSVG($text, $outfile, $saveandprint=false);
}
//----------------------------------------------------------------------
public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
{
@ -3209,6 +3247,8 @@
public $version = 0;
public $size = 3;
public $margin = 4;
public $back_color = 0xFFFFFF;
public $fore_color = 0x000000;
public $structured = 0; // not supported yet
@ -3216,11 +3256,14 @@
public $hint = QR_MODE_8;
//----------------------------------------------------------------------
public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$enc = new QRencode();
$enc->size = $size;
$enc->margin = $margin;
$enc->fore_color = $fore_color;
$enc->back_color = $back_color;
$enc->cmyk = $cmyk;
switch ($level.'') {
case '0':
@ -3299,7 +3342,55 @@
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
} catch (Exception $e) {
QRtools::log($outfile, $e->getMessage());
}
}
//----------------------------------------------------------------------
public function encodeEPS($intext, $outfile = false,$saveandprint=false)
{
try {
ob_start();
$tab = $this->encode($intext);
$err = ob_get_contents();
ob_end_clean();
if ($err != '')
QRtools::log($outfile, $err);
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color, $this->cmyk);
} catch (Exception $e) {
QRtools::log($outfile, $e->getMessage());
}
}
//----------------------------------------------------------------------
public function encodeSVG($intext, $outfile = false,$saveandprint=false)
{
try {
ob_start();
$tab = $this->encode($intext);
$err = ob_get_contents();
ob_end_clean();
if ($err != '')
QRtools::log($outfile, $err);
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
} catch (Exception $e) {
@ -3310,3 +3401,225 @@
}
//---- qrvect.php -----------------------------
/*
* PHP QR Code encoder
*
* Image output of code using GD2
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define('QR_VECT', true);
class QRvect {
//----------------------------------------------------------------------
public static function eps($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color, $cmyk);
if ($filename === false) {
header("Content-Type: application/postscript");
header('Content-Disposition: filename="qrcode.eps"');
echo $vect;
} else {
if($saveandprint===TRUE){
QRtools::save($vect, $filename);
header("Content-Type: application/postscript");
header('Content-Disposition: filename="qrcode.eps"');
echo $vect;
}else{
QRtools::save($vect, $filename);
}
}
}
//----------------------------------------------------------------------
private static function vectEPS($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$h = count($frame);
$w = strlen($frame[0]);
$imgW = $w + 2*$outerFrame;
$imgH = $h + 2*$outerFrame;
if ($cmyk)
{
// convert color value into decimal eps format
$c = round((($fore_color & 0xFF000000) >> 16) / 255, 5);
$m = round((($fore_color & 0x00FF0000) >> 16) / 255, 5);
$y = round((($fore_color & 0x0000FF00) >> 8) / 255, 5);
$k = round(($fore_color & 0x000000FF) / 255, 5);
$fore_color_string = $c.' '.$m.' '.$y.' '.$k.' setcmykcolor'."\n";
// convert color value into decimal eps format
$c = round((($back_color & 0xFF000000) >> 16) / 255, 5);
$m = round((($back_color & 0x00FF0000) >> 16) / 255, 5);
$y = round((($back_color & 0x0000FF00) >> 8) / 255, 5);
$k = round(($back_color & 0x000000FF) / 255, 5);
$back_color_string = $c.' '.$m.' '.$y.' '.$k.' setcmykcolor'."\n";
}
else
{
// convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
$r = round((($fore_color & 0xFF0000) >> 16) / 255, 5);
$b = round((($fore_color & 0x00FF00) >> 8) / 255, 5);
$g = round(($fore_color & 0x0000FF) / 255, 5);
$fore_color_string = $r.' '.$b.' '.$g.' setrgbcolor'."\n";
// convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
$r = round((($back_color & 0xFF0000) >> 16) / 255, 5);
$b = round((($back_color & 0x00FF00) >> 8) / 255, 5);
$g = round(($back_color & 0x0000FF) / 255, 5);
$back_color_string = $r.' '.$b.' '.$g.' setrgbcolor'."\n";
}
$output =
'%!PS-Adobe EPSF-3.0'."\n".
'%%Creator: PHPQrcodeLib'."\n".
'%%Title: QRcode'."\n".
'%%CreationDate: '.date('Y-m-d')."\n".
'%%DocumentData: Clean7Bit'."\n".
'%%LanguageLevel: 2'."\n".
'%%Pages: 1'."\n".
'%%BoundingBox: 0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint."\n";
// set the scale
$output .= $pixelPerPoint.' '.$pixelPerPoint.' scale'."\n";
// position the center of the coordinate system
$output .= $outerFrame.' '.$outerFrame.' translate'."\n";
// redefine the 'rectfill' operator to shorten the syntax
$output .= '/F { rectfill } def'."\n";
// set the symbol color
$output .= $back_color_string;
$output .= '-'.$outerFrame.' -'.$outerFrame.' '.($w + 2*$outerFrame).' '.($h + 2*$outerFrame).' F'."\n";
// set the symbol color
$output .= $fore_color_string;
// Convert the matrix into pixels
for($i=0; $i<$h; $i++) {
for($j=0; $j<$w; $j++) {
if( $frame[$i][$j] == '1') {
$y = $h - 1 - $i;
$x = $j;
$output .= $x.' '.$y.' 1 1 F'."\n";
}
}
}
$output .='%%EOF';
return $output;
}
//----------------------------------------------------------------------
public static function svg($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
{
$vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
if ($filename === false) {
header("Content-Type: image/svg+xml");
//header('Content-Disposition: attachment, filename="qrcode.svg"');
echo $vect;
} else {
if($saveandprint===TRUE){
QRtools::save($vect, $filename);
header("Content-Type: image/svg+xml");
//header('Content-Disposition: filename="'.$filename.'"');
echo $vect;
}else{
QRtools::save($vect, $filename);
}
}
}
//----------------------------------------------------------------------
private static function vectSVG($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$h = count($frame);
$w = strlen($frame[0]);
$imgW = $w + 2*$outerFrame;
$imgH = $h + 2*$outerFrame;
$output =
'<?xml version="1.0" encoding="utf-8"?>'."\n".
'<svg version="1.1" baseProfile="full" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">'."\n".
'<desc></desc>'."\n";
$output =
'<?xml version="1.0" encoding="utf-8"?>'."\n".
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">'."\n".
'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'">'."\n".
'<desc></desc>'."\n";
if(!empty($back_color)) {
$backgroundcolor = str_pad(dechex($back_color), 6, "0", STR_PAD_LEFT);
$output .= '<rect width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" fill="#'.$backgroundcolor.'" cx="0" cy="0" />'."\n";
}
$output .=
'<defs>'."\n".
'<rect id="p" width="'.$pixelPerPoint.'" height="'.$pixelPerPoint.'" />'."\n".
'</defs>'."\n".
'<g fill="#'.str_pad(dechex($fore_color), 6, "0", STR_PAD_LEFT).'">'."\n";
// Convert the matrix into pixels
for($i=0; $i<$h; $i++) {
for($j=0; $j<$w; $j++) {
if( $frame[$i][$j] == '1') {
$y = ($i + $outerFrame) * $pixelPerPoint;
$x = ($j + $outerFrame) * $pixelPerPoint;
$output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n";
}
}
}
$output .=
'</g>'."\n".
'</svg>';
return $output;
}
}

View File

@ -129,7 +129,7 @@
//----------------------------------------------------------------------
public function getCode()
{
$ret;
$ret = NULL;
if($this->count < $this->dataLength) {
$row = $this->count % $this->blocks;
@ -243,7 +243,7 @@
//----------------------------------------------------------------------
public function encodeString8bit($string, $version, $level)
{
if(string == NULL) {
if($string == NULL) {
throw new Exception('empty string!');
return NULL;
}
@ -280,9 +280,9 @@
}
//----------------------------------------------------------------------
public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false)
public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$enc = QRencode::factory($level, $size, $margin);
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
return $enc->encodePNG($text, $outfile, $saveandprint=false);
}
@ -293,6 +293,20 @@
return $enc->encode($text, $outfile);
}
//----------------------------------------------------------------------
public static function eps($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color, $cmyk);
return $enc->encodeEPS($text, $outfile, $saveandprint=false);
}
//----------------------------------------------------------------------
public static function svg($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
return $enc->encodeSVG($text, $outfile, $saveandprint=false);
}
//----------------------------------------------------------------------
public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
{
@ -401,6 +415,8 @@
public $version = 0;
public $size = 3;
public $margin = 4;
public $back_color = 0xFFFFFF;
public $fore_color = 0x000000;
public $structured = 0; // not supported yet
@ -408,11 +424,14 @@
public $hint = QR_MODE_8;
//----------------------------------------------------------------------
public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$enc = new QRencode();
$enc->size = $size;
$enc->margin = $margin;
$enc->fore_color = $fore_color;
$enc->back_color = $back_color;
$enc->cmyk = $cmyk;
switch ($level.'') {
case '0':
@ -491,7 +510,55 @@
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
} catch (Exception $e) {
QRtools::log($outfile, $e->getMessage());
}
}
//----------------------------------------------------------------------
public function encodeEPS($intext, $outfile = false,$saveandprint=false)
{
try {
ob_start();
$tab = $this->encode($intext);
$err = ob_get_contents();
ob_end_clean();
if ($err != '')
QRtools::log($outfile, $err);
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color, $this->cmyk);
} catch (Exception $e) {
QRtools::log($outfile, $e->getMessage());
}
}
//----------------------------------------------------------------------
public function encodeSVG($intext, $outfile = false,$saveandprint=false)
{
try {
ob_start();
$tab = $this->encode($intext);
$err = ob_get_contents();
ob_end_clean();
if ($err != '')
QRtools::log($outfile, $err);
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
} catch (Exception $e) {

View File

@ -27,9 +27,9 @@
class QRimage {
//----------------------------------------------------------------------
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
{
$image = self::image($frame, $pixelPerPoint, $outerFrame);
$image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
if ($filename === false) {
Header("Content-type: image/png");
@ -63,7 +63,7 @@
}
//----------------------------------------------------------------------
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$h = count($frame);
$w = strlen($frame[0]);
@ -73,8 +73,20 @@
$base_image =ImageCreate($imgW, $imgH);
$col[0] = ImageColorAllocate($base_image,255,255,255);
$col[1] = ImageColorAllocate($base_image,0,0,0);
// convert a hexadecimal color code into decimal format (red = 255 0 0, green = 0 255 0, blue = 0 0 255)
$r1 = round((($fore_color & 0xFF0000) >> 16), 5);
$g1 = round((($fore_color & 0x00FF00) >> 8), 5);
$b1 = round(($fore_color & 0x0000FF), 5);
// convert a hexadecimal color code into decimal format (red = 255 0 0, green = 0 255 0, blue = 0 0 255)
$r2 = round((($back_color & 0xFF0000) >> 16), 5);
$g2 = round((($back_color & 0x00FF00) >> 8), 5);
$b2 = round(($back_color & 0x0000FF), 5);
$col[0] = ImageColorAllocate($base_image, $r2, $g2, $b2);
$col[1] = ImageColorAllocate($base_image, $r1, $g1, $b1);
imagefill($base_image, 0, 0, $col[0]);

View File

@ -45,7 +45,6 @@
if(!QRinput::check($mode, $size, $setData)) {
throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
return null;
}
$this->mode = $mode;
@ -283,7 +282,6 @@
{
if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
throw new Exception('Invalid version no');
return NULL;
}
$this->version = $version;
@ -620,7 +618,6 @@
$ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
if($ver < 0) {
throw new Exception('WRONG VERSION');
return -1;
} else if($ver > $this->getVersion()) {
$this->setVersion($ver);
} else {

View File

@ -34,6 +34,7 @@
include $QR_BASEDIR."qrtools.php";
include $QR_BASEDIR."qrspec.php";
include $QR_BASEDIR."qrimage.php";
include $QR_BASEDIR."qrvect.php";
include $QR_BASEDIR."qrinput.php";
include $QR_BASEDIR."qrbitstream.php";
include $QR_BASEDIR."qrsplit.php";

View File

@ -186,7 +186,7 @@
if($ret < 0)
return -1;
return $run;
return $ret;
}
//----------------------------------------------------------------------
@ -258,7 +258,7 @@
case QR_MODE_NUM: $length = $this->eatNum(); break;
case QR_MODE_AN: $length = $this->eatAn(); break;
case QR_MODE_KANJI:
if ($hint == QR_MODE_KANJI)
if ($mode == QR_MODE_KANJI)
$length = $this->eatKanji();
else $length = $this->eat8();
break;
@ -280,7 +280,7 @@
$p = 0;
while ($p<$stringLen) {
$mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
$mode = self::identifyMode(substr($this->dataStr, $p));
if($mode == QR_MODE_KANJI) {
$p += 2;
} else {

View File

@ -164,6 +164,19 @@
</table>';
}
public static function save($content, $filename_path)
{
try {
$handle = fopen($filename_path, "w");
fwrite($handle, $content);
fclose($handle);
return true;
} catch (Exception $e) {
echo 'Exception reçue : ', $e->getMessage(), "\n";
}
}
}
//##########################################################################

214
phpqrcode/qrvect.php Executable file
View File

@ -0,0 +1,214 @@
<?php
/*
* PHP QR Code encoder
*
* Image output of code using GD2
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define('QR_VECT', true);
class QRvect {
//----------------------------------------------------------------------
public static function eps($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color, $cmyk);
if ($filename === false) {
header("Content-Type: application/postscript");
header('Content-Disposition: filename="qrcode.eps"');
echo $vect;
} else {
if($saveandprint===TRUE){
QRtools::save($vect, $filename);
header("Content-Type: application/postscript");
header('Content-Disposition: filename="qrcode.eps"');
echo $vect;
}else{
QRtools::save($vect, $filename);
}
}
}
//----------------------------------------------------------------------
private static function vectEPS($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
{
$h = count($frame);
$w = strlen($frame[0]);
$imgW = $w + 2*$outerFrame;
$imgH = $h + 2*$outerFrame;
if ($cmyk)
{
// convert color value into decimal eps format
$c = round((($fore_color & 0xFF000000) >> 16) / 255, 5);
$m = round((($fore_color & 0x00FF0000) >> 16) / 255, 5);
$y = round((($fore_color & 0x0000FF00) >> 8) / 255, 5);
$k = round(($fore_color & 0x000000FF) / 255, 5);
$fore_color_string = $c.' '.$m.' '.$y.' '.$k.' setcmykcolor'."\n";
// convert color value into decimal eps format
$c = round((($back_color & 0xFF000000) >> 16) / 255, 5);
$m = round((($back_color & 0x00FF0000) >> 16) / 255, 5);
$y = round((($back_color & 0x0000FF00) >> 8) / 255, 5);
$k = round(($back_color & 0x000000FF) / 255, 5);
$back_color_string = $c.' '.$m.' '.$y.' '.$k.' setcmykcolor'."\n";
}
else
{
// convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
$r = round((($fore_color & 0xFF0000) >> 16) / 255, 5);
$b = round((($fore_color & 0x00FF00) >> 8) / 255, 5);
$g = round(($fore_color & 0x0000FF) / 255, 5);
$fore_color_string = $r.' '.$b.' '.$g.' setrgbcolor'."\n";
// convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
$r = round((($back_color & 0xFF0000) >> 16) / 255, 5);
$b = round((($back_color & 0x00FF00) >> 8) / 255, 5);
$g = round(($back_color & 0x0000FF) / 255, 5);
$back_color_string = $r.' '.$b.' '.$g.' setrgbcolor'."\n";
}
$output =
'%!PS-Adobe EPSF-3.0'."\n".
'%%Creator: PHPQrcodeLib'."\n".
'%%Title: QRcode'."\n".
'%%CreationDate: '.date('Y-m-d')."\n".
'%%DocumentData: Clean7Bit'."\n".
'%%LanguageLevel: 2'."\n".
'%%Pages: 1'."\n".
'%%BoundingBox: 0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint."\n";
// set the scale
$output .= $pixelPerPoint.' '.$pixelPerPoint.' scale'."\n";
// position the center of the coordinate system
$output .= $outerFrame.' '.$outerFrame.' translate'."\n";
// redefine the 'rectfill' operator to shorten the syntax
$output .= '/F { rectfill } def'."\n";
// set the symbol color
$output .= $back_color_string;
$output .= '-'.$outerFrame.' -'.$outerFrame.' '.($w + 2*$outerFrame).' '.($h + 2*$outerFrame).' F'."\n";
// set the symbol color
$output .= $fore_color_string;
// Convert the matrix into pixels
for($i=0; $i<$h; $i++) {
for($j=0; $j<$w; $j++) {
if( $frame[$i][$j] == '1') {
$y = $h - 1 - $i;
$x = $j;
$output .= $x.' '.$y.' 1 1 F'."\n";
}
}
}
$output .='%%EOF';
return $output;
}
//----------------------------------------------------------------------
public static function svg($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
{
$vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
if ($filename === false) {
header("Content-Type: image/svg+xml");
//header('Content-Disposition: attachment, filename="qrcode.svg"');
echo $vect;
} else {
if($saveandprint===TRUE){
QRtools::save($vect, $filename);
header("Content-Type: image/svg+xml");
//header('Content-Disposition: filename="'.$filename.'"');
echo $vect;
}else{
QRtools::save($vect, $filename);
}
}
}
//----------------------------------------------------------------------
private static function vectSVG($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
{
$h = count($frame);
$w = strlen($frame[0]);
$imgW = $w + 2*$outerFrame;
$imgH = $h + 2*$outerFrame;
$output =
'<?xml version="1.0" encoding="utf-8"?>'."\n".
'<svg version="1.1" baseProfile="full" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">'."\n".
'<desc></desc>'."\n";
$output =
'<?xml version="1.0" encoding="utf-8"?>'."\n".
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">'."\n".
'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'">'."\n".
'<desc></desc>'."\n";
if(!empty($back_color)) {
$backgroundcolor = str_pad(dechex($back_color), 6, "0", STR_PAD_LEFT);
$output .= '<rect width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" fill="#'.$backgroundcolor.'" cx="0" cy="0" />'."\n";
}
$output .=
'<defs>'."\n".
'<rect id="p" width="'.$pixelPerPoint.'" height="'.$pixelPerPoint.'" />'."\n".
'</defs>'."\n".
'<g fill="#'.str_pad(dechex($fore_color), 6, "0", STR_PAD_LEFT).'">'."\n";
// Convert the matrix into pixels
for($i=0; $i<$h; $i++) {
for($j=0; $j<$w; $j++) {
if( $frame[$i][$j] == '1') {
$y = ($i + $outerFrame) * $pixelPerPoint;
$x = ($j + $outerFrame) * $pixelPerPoint;
$output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n";
}
}
}
$output .=
'</g>'."\n".
'</svg>';
return $output;
}
}

0
phpqrcode/temp/tempfolder Executable file
View File

View File

@ -43,7 +43,8 @@
$QR_BASEDIR.'qrsplit.php',
$QR_BASEDIR.'qrrscode.php',
$QR_BASEDIR.'qrmask.php',
$QR_BASEDIR.'qrencode.php'
$QR_BASEDIR.'qrencode.php',
$QR_BASEDIR.'qrvect.php'
);
$headerFile = $QR_TOOLSDIR.'merged_header.php';

View File

@ -6,14 +6,15 @@
* This file contains MERGED version of PHP QR Code library.
* It was auto-generated from full version for your convenience.
*
* This merged version was configured to not requre any external files,
* with disabled cache, error loging and weker but faster mask matching.
* This merged version was configured to not require any external files,
* with disabled cache, error logging and weaker but faster mask matching.
* If you need tune it up please use non-merged version.
*
* For full version, documentation, examples of use please visit:
*
* http://phpqrcode.sourceforge.net/
* https://sourceforge.net/projects/phpqrcode/
* https://github.com/t0k4rt/phpqrcode
*
* PHP QR Code is distributed under LGPL 3
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>

View File

@ -1,11 +1,13 @@
/*
Code publié sous licence Apache 2.0
https://code.antopie.org/miraty/qr
*/
@font-face {
font-family: "ubuntu-dl";
src: url('ubuntu-dl.ttf');
}
#redondance, #marge, #texte, #taille {
appearance: none;
border: 2px @bordure solid;
border-radius: 7px;
font-size: 20px;
@ -138,11 +140,11 @@ h1, #logo {
html {
margin: 10px;
width: 400px;
width: 100%;
}
#texte {
width: 400px;
width: 90%;
}
h1 {
@ -156,8 +158,8 @@ h1, #logo {
}
::placeholder {
color: @texte;
opacity: 0.6;
color: fadeout(@texte, 50%);
opacity: 1;
}
/* Infobulle */
@ -175,7 +177,7 @@ h1, #logo {
position: absolute;
transform: scale(0) rotate(-12deg);
color: #FFFFFF;
background: rgba(0,0,0,.9);
background: rgba(0,0,0,1);
padding: 15px;
border-radius: 3px;
box-shadow: 0 0 2px rgba(0,0,0,.5);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B