Cara menggunakan php qrcode detector decoder

Presensi merupakan hal utama dalam suatu kegiatan, karena menjadi bukti dari laporan pelaksanaan. Umumnya, presensi kehadiran dilakukan secara manual, yaitu siswa membubuhkan tanda tangan pada daftar hadir yang diedarkan, atau guru memanggil siswa satu persatu. Namun metode tersebut mengakibatkan terjadinya pemborosan waktu dan sumber daya. Hadirnya teknologi QR-Code berbasis android memberikan solusi agar presensi dapat berjalan dengan efisien. Penelitian ini memiliki tiga konfigurasi sistem, diantaranya sistem encoder, sistem hardware, dan sistem decoder. Sistem encoder melakukan proses encode data berupa Nomor Induk Siswa Nasional (NISN) menjadi QR-Code menggunakan kode Bose, Chaudhuri, Hocquenghem (BCH). Sistem hardware terdiri dari perangkat android dan kartu pelajar. Sistem decoder melakukan proses deteksi QR-Code dengan aplikasi Smart Presence. Sistem diuji dengan pengujian black box, pengujian jarak deteksi, pengujian deteksi berdasarkan cahaya, serta pengujian kartu pelajar bernoda dan rusak. Sistem presensi mampu mendeteksi QR-Code dengan jarak minimal sebesar 3 cm dan jarak maksimal sebesar 45 cm dengan tingkat akurasi sebesar 98 % dan rata-rata waktu komputasi sebesar 1,3 detik.

 

Abstract

Presence is the main thing in an activity because it becomes evidence of the implementation report. Generally, attendance is done manually, i.e. students sign on the circulated attendance list, or the teacher calls students one by one. However, this method resulted in a waste of time and resources. The presence of Android-based QR-Code technology provides a solution so that the presence can run efficiently. This research has three system configurations, including the encoder system, hardware system, and decoder system. The encoder system encodes data in the form of a National Student Number (NISN) into a QR-Code using the Bose, Chaudhuri, Hocquenghem (BCH) codes. The hardware system consists of an Android device and a student card. The decoder system carries out the QR-Code detection process with the Smart Presence application. The system was tested with black-box testing, detection distance testing, light-based detection testing, and stained and damaged student card testing. The presence system is able to detect QR-Code with a minimum distance of 3 cm and a maximum distance of 45 cm with an accuracy rate of 98% and an average computing time of 1.3 seconds.


Teks Lengkap:

PDF

Referensi


S. TIWARI. 2016. An Introduction to QR Code Technology. India: SITS Educators Society.

M. LUKMAN, LUTFI A M. 2016. Smart Presence menggunakan QR-Code dengan enkripsi Vignere Cipher. Jember: Universitas Muhammadiyah Jember.

EKO, F S. 2014. Simulasi Kode Hamming, Kode BCH, dan Kode Reed-Solomon untuk Optimalisasi Forward Error Correction. Makalah. Surakarta: Universitas Muhammadiyah Surakarta.

EKO, S. 2009. Analisis Kinerja Kode BCH. Medan: Universitas Sumatera Utara.

P. KRISMANTO, K. USMAN, L. NOVAMIZANTI. 2011. Desain dan Implementasi Prototype Sistem Presensi Otomatis Berbasis Barcode Menggunakan Webcam dan Pengolahan Citra Digital di IT Telkom. Bandung: IT Telkom.

N. ISWANTO, K. USMAN, L. NOVAMIZANTI. 2011. Sistem Verifikasi Nomor Kendaraan Bermotor Dengan Database Menggunakan Pengolahan Citra Digital pada Sistem Keluaran Parkir. Bandung: IT Telkom.

K. USMAN, SEPTIRASYAHYANI, L. NOVAMIZANTI. 2011. Desain dan Implementasi QR-Code Berbasiskan Pengolahan Citra untuk Sistem Parkir di IT Telkom. Bandung: IT Telkom.

K. INDARTONO, A. JAHIR. 2019. Prototype Sistem Keamanan Mobil Dengan Mengunakan Quick Response Code Berbasis Android dan Arduino. Jurnal Teknologi Informasi dan Ilmu Komputer (JTIIK), Vol. 6, No. 3, Juni 2019, hlm. 235-244.

Lets say I've generated with PHP and some library (zxing or something else) a QRCode and its printed on a piece of paper, ok?

What i would like to do now, is to read it back with tablet/smartphone throught a web-page. I browse to that page, it asks me to aim the QRCode with the camera, and then the scanned content is sent back to the page that decodes it.

There's something out there to handle this without the need to use an Android/iOS app? It could be another type of 2D barcode aswell, not exclusively a QRCode.

This library helps you generate QR codes in a jiffy. Makes use of bacon/bacon-qr-code to generate the matrix and khanamiryan/qrcode-detector-decoder for validating generated QR codes. Further extended with Twig extensions, generation routes, a factory and a Symfony bundle for easy installation and configuration. Different writers are provided to generate the QR code as PNG, SVG, EPS or in binary format.

Cara menggunakan php qrcode detector decoder

Installation

Use Composer to install the library. Also make sure you have enabled and configured the GD extension if you want to generate images.

$ composer require endroid/qr-code

Usage: using the builder

use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
use Endroid\QrCode\Label\Alignment\LabelAlignmentCenter;
use Endroid\QrCode\Label\Font\NotoSans;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;

$result = Builder::create()
    ->writer(new PngWriter())
    ->writerOptions([])
    ->data('Custom QR code contents')
    ->encoding(new Encoding('UTF-8'))
    ->errorCorrectionLevel(new ErrorCorrectionLevelHigh())
    ->size(300)
    ->margin(10)
    ->roundBlockSizeMode(new RoundBlockSizeModeMargin())
    ->logoPath(__DIR__.'/assets/symfony.png')
    ->labelText('This is the label')
    ->labelFont(new NotoSans(20))
    ->labelAlignment(new LabelAlignmentCenter())
    ->validateResult(false)
    ->build();

Usage: without using the builder

use Endroid\QrCode\Color\Color;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
use Endroid\QrCode\QrCode;
use Endroid\QrCode\Label\Label;
use Endroid\QrCode\Logo\Logo;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\ValidationException;

$writer = new PngWriter();

// Create QR code
$qrCode = QrCode::create('Life is too short to be generating QR codes')
    ->setEncoding(new Encoding('UTF-8'))
    ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
    ->setSize(300)
    ->setMargin(10)
    ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
    ->setForegroundColor(new Color(0, 0, 0))
    ->setBackgroundColor(new Color(255, 255, 255));

// Create generic logo
$logo = Logo::create(__DIR__.'/assets/symfony.png')
    ->setResizeToWidth(50);

// Create generic label
$label = Label::create('Label')
    ->setTextColor(new Color(255, 0, 0));

$result = $writer->write($qrCode, $logo, $label);

// Validate the result
$writer->validateResult($result, 'Life is too short to be generating QR codes');

Usage: working with results

// Directly output the QR code
header('Content-Type: '.$result->getMimeType());
echo $result->getString();

// Save it to a file
$result->saveToFile(__DIR__.'/qrcode.png');

// Generate a data URI to include image data inline (i.e. inside an <img> tag)
$dataUri = $result->getDataUri();

Writer options

use Endroid\QrCode\Writer\SvgWriter;

$builder->setWriterOptions([SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true]);

Encoding

If you use a barcode scanner you can have some troubles while reading the generated QR codes. Depending on the encoding you chose you will have an extra amount of data corresponding to the ECI block. Some barcode scanner are not programmed to interpret this block of information. To ensure a maximum compatibility you can use the ISO-8859-1 encoding that is the default encoding used by barcode scanners (if your character set supports it, i.e. no Chinese characters are present).

Round block size mode

By default block sizes are rounded to guarantee sharp images and improve readability. However some other rounding variants are available.

  • margin (default): the size of the QR code is shrunk if necessary but the size of the final image remains unchanged due to additional margin being added.
  • enlarge: the size of the QR code and the final image are enlarged when rounding differences occur.
  • shrink: the size of the QR code and the final image are shrunk when rounding differences occur.
  • none: No rounding. This mode can be used when blocks don't need to be rounded to pixels (for instance SVG).

Readability

The readability of a QR code is primarily determined by the size, the input length, the error correction level and any possible logo over the image so you can tweak these parameters if you are looking for optimal results. You can also check $qrCode->getRoundBlockSize() value to see if block dimensions are rounded so that the image is more sharp and readable. Please note that rounding block size can result in additional padding to compensate for the rounding difference. And finally the encoding (default UTF-8 to support large character sets) can be set to ISO-8859-1 if possible to improve readability.

Validating the generated QR code

If you need to be extra sure the QR code you generated is readable and contains the exact data you requested you can enable the validation reader, which is disabled by default. You can do this either via the builder or directly on any writer that supports validation. See the examples above.

Please note that validation affects performance so only use it in case of problems.

Symfony integration

The endroid/qr-code-bundle integrates the QR code library in Symfony for an even better experience.

  • Configure your defaults (like image size, default writer etc.)
  • Support for multiple configurations and injection via aliases
  • Generate QR codes for defined configurations via URL like /qr-code//Hello
  • Generate QR codes or URLs directly from Twig using dedicated functions

Read the bundle documentation for more information.

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.