<?php require_once __DIR__.'/../app/bootstrap.php'; require_once __DIR__.'/_layout.php'; $user=require_login($pdo); $id=(int)($_GET['id']??0); $stmt=$pdo->prepare('SELECT q.* FROM '.qtbl('qr_codes').' q WHERE q.id=? AND '.qr_access_where('q')); $stmt->execute([$id,$user['id'],$user['id']]); $qr=$stmt->fetch(); if(!$qr){http_response_code(404);exit('Nicht gefunden');} $short=base_url($config).'/q/'.$qr['code']; $logoUrl=!empty($qr['logo_path'])?'logo.php?id='.(int)$qr['id']:''; page_header('QR-Code herunterladen'); ?>
<section class="card preview"><div class="qrbox"><canvas id="qr-main" class="qr" width="384" height="384" data-text="<?= e($short) ?>" data-fg="<?= e($qr['foreground_color']) ?>" data-bg="<?= e($qr['background_color']) ?>" data-transparent="<?= (int)$qr['transparent_background'] ?>" data-logo="<?= e($logoUrl) ?>"></canvas></div><div><h2><?= e($qr['title']) ?></h2><p class="muted"><?= e($short) ?></p><div class="downloads"><button class="btn" data-download="png" data-target="#qr-main" data-name="<?= e($qr['code']) ?>">PNG herunterladen</button><button class="btn" data-download="jpg" data-target="#qr-main" data-name="<?= e($qr['code']) ?>">JPEG herunterladen</button><button class="btn" data-download="svg" data-target="#qr-main" data-name="<?= e($qr['code']) ?>">SVG herunterladen</button></div></div></section><?php page_footer(); ?>
