summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-06-09 17:32:33 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-06-09 22:07:40 +0200
commit6458123e1276147095f296522a61823676006f3f (patch)
tree6e3d7c613302310b892df08900de2166c97ed5fd
parent8c572f55b17b86cbfa56f18f0491e05092f755b1 (diff)
Use PHP library for QR codes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--.gitmodules3
-rw-r--r--README.md1
-rw-r--r--application/controllers/file.php6
-rw-r--r--application/libraries/Customautoloader.php3
m---------application/third_party/QrCode0
-rw-r--r--docker/Dockerfile2
-rw-r--r--install.php8
7 files changed, 12 insertions, 11 deletions
diff --git a/.gitmodules b/.gitmodules
index 7209fd166..8e18180fc 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "application/third_party/mockery"]
path = application/third_party/mockery
url = https://github.com/padraic/mockery.git
+[submodule "application/third_party/QrCode"]
+ path = application/third_party/QrCode
+ url = https://github.com/endroid/QrCode.git
diff --git a/README.md b/README.md
index 0724eae01..289ead211 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,6 @@ not need to register to be allowed to post.
* [pygmentize](http://pygments.org/) for code highlighting
* [ansi2html](http://pypi.python.org/pypi/ansi2html) for shell output rendering (ANSI color codes)
-* [qrencode](http://megaui.net/fukuchi/works/qrencode/index.en.html) for qrcode generation
* [imagemagick](http://www.imagemagick.org/) for additional thumbnail generation
* [node.js](https://nodejs.org/) for javascript minification
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 56928015f..7c49988bf 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -131,7 +131,11 @@ class File extends MY_Controller {
handle_etag($etag);
header("Content-disposition: inline; filename=\"".$id."_qr.png\"\n");
header("Content-Type: image/png\n");
- echo (new \libraries\ProcRunner(array('qrencode', '-s', '10', '-o', '-', site_url($id).'/')))->execSafe()['stdout'];
+ $qr = new \Endroid\QrCode\QrCode();
+ $qr->setText(site_url($id).'/')
+ ->setSize(350)
+ ->setErrorCorrection('low')
+ ->render();
exit();
case "info":
diff --git a/application/libraries/Customautoloader.php b/application/libraries/Customautoloader.php
index 6a616ba7f..426364ee3 100644
--- a/application/libraries/Customautoloader.php
+++ b/application/libraries/Customautoloader.php
@@ -17,6 +17,9 @@ class CustomAutoloader{
public function loader($className)
{
$namespaces = array(
+ 'Endroid\QrCode' => [
+ ["path" => APPPATH."/third_party/QrCode/src/"],
+ ],
'' => [
["path" => APPPATH],
["path" => APPPATH."/third_party/mockery/library/"]
diff --git a/application/third_party/QrCode b/application/third_party/QrCode
new file mode 160000
+Subproject 4638f11b6944cccce997db7fa7508b5a7ad1a61
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 395faf4d6..70e82f9e2 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y && \
apt-get install -y php5 php5-mysql php5-gd php5-imagick libtext-markdown-perl expect \
- python-pygments qrencode imagemagick git python-pip realpath curl apt-transport-https
+ python-pygments imagemagick git python-pip realpath curl apt-transport-https
RUN echo 'deb https://deb.nodesource.com/node_4.x trusty main' > /etc/apt/sources.list.d/nodesource.list
RUN echo 'deb-src https://deb.nodesource.com/node_4.x trusty main' >> /etc/apt/sources.list.d/nodesource.list
diff --git a/install.php b/install.php
index 3d486d911..1deb8cc2a 100644
--- a/install.php
+++ b/install.php
@@ -60,14 +60,6 @@ if ($buf != "0") {
$errors .= " - Error when testing ansi2html: Return code was \"$buf\".\n";
}
-// test qrencode
-ob_start();
-passthru("qrencode -V 2>&1", $buf);
-ob_end_clean();
-if ($buf != "0") {
- $errors .= " - Error when testing qrencode: Return code was \"$buf\".\n";
-}
-
// test imagemagick
ob_start();
passthru("convert --version 2>&1", $buf);