From 6458123e1276147095f296522a61823676006f3f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 9 Jun 2016 17:32:33 +0200 Subject: Use PHP library for QR codes Signed-off-by: Florian Pritz --- application/controllers/file.php | 6 +++++- application/libraries/Customautoloader.php | 3 +++ application/third_party/QrCode | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 160000 application/third_party/QrCode (limited to 'application') 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 index 000000000..4638f11b6 --- /dev/null +++ b/application/third_party/QrCode @@ -0,0 +1 @@ +Subproject commit 4638f11b6944cccce997db7fa7508b5a7ad1a61b -- cgit v1.2.3-24-g4f1b