This commit is contained in:
29
app/Libraries/qrcode.php
Normal file
29
app/Libraries/qrcode.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class Qrcode
|
||||
{
|
||||
|
||||
public function scan($filename)
|
||||
{
|
||||
$data = '';
|
||||
$file = urldecode($filename);
|
||||
|
||||
if (!file_exists($file)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$image = new ZBarCodeImage($file);
|
||||
$scanner = new ZBarCodeScanner();
|
||||
$barcode = $scanner->scan($image);
|
||||
if (!empty($barcode)) {
|
||||
foreach ($barcode as $code) {
|
||||
$data .= ',' . $code['data'];
|
||||
}
|
||||
if (!empty($data))
|
||||
$data = substr($data, 1);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user