mirror of
git://f0xx.org/ac/ac-deploy
synced 2026-07-29 07:37:47 +03:00
Use QrBrandedRenderer for lab-seed short-link QR PNG generation.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -596,6 +596,9 @@ final class ShortLinksRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function renderQrPng(string $text, int $size = 256): ?string {
|
public static function renderQrPng(string $text, int $size = 256): ?string {
|
||||||
|
if (class_exists('QrBrandedRenderer', false)) {
|
||||||
|
return QrBrandedRenderer::renderPng($text, $size);
|
||||||
|
}
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
if ($text === '') {
|
if ($text === '') {
|
||||||
return null;
|
return null;
|
||||||
@@ -605,9 +608,9 @@ final class ShortLinksRepository {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$size = max(128, min(512, $size));
|
$size = max(128, min(512, $size));
|
||||||
$moduleSize = max(2, (int) round($size / 40));
|
$moduleSize = max(3, (int) round($size / 33));
|
||||||
$cmd = sprintf(
|
$cmd = sprintf(
|
||||||
'%s -t PNG -s %d -m 1 -o - %s 2>/dev/null',
|
'%s -l H -t PNG -s %d -m 2 -o - %s 2>/dev/null',
|
||||||
escapeshellcmd($qrencode),
|
escapeshellcmd($qrencode),
|
||||||
$moduleSize,
|
$moduleSize,
|
||||||
escapeshellarg($text)
|
escapeshellarg($text)
|
||||||
|
|||||||
Reference in New Issue
Block a user