Fix QR generation using save method
This commit is contained in:
parent
81fca09069
commit
b06207810b
@ -177,15 +177,11 @@ class ItemController
|
|||||||
mkdir($qrDir, 0755, true);
|
mkdir($qrDir, 0755, true);
|
||||||
}
|
}
|
||||||
$options = new QROptions([
|
$options = new QROptions([
|
||||||
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
|
'outputType' => QRCode::OUTPUT_SVG,
|
||||||
'eccLevel' => QRCode::ECC_L,
|
'eccLevel' => QRCode::ECC_L,
|
||||||
]);
|
]);
|
||||||
$qrCode = new QRCode($options);
|
$qrCode = new QRCode($options);
|
||||||
$svg = $qrCode->render($idCode);
|
$qrCode->render($idCode, $qrDir . $idCode . '.svg');
|
||||||
if (strpos($svg, 'data:image/svg+xml;base64,') === 0) {
|
|
||||||
$svg = base64_decode(substr($svg, 26)); // 26 is length of 'data:image/svg+xml;base64,'
|
|
||||||
}
|
|
||||||
file_put_contents($qrDir . $idCode . '.svg', $svg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function printQR($id) {
|
public static function printQR($id) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user