Files
immich/web/src/lib/components/shared-components/qrcode.svelte
matthieu-db d5923241b5 fix: add quiet zone to QR code (#19771)
Add quiet zone to QR code

This is needed for the QR code to be readable by many QR readers. It is also a requirement for it to be a valid QR code.
2025-07-06 22:06:36 -05:00

21 lines
470 B
Svelte

<script lang="ts">
import QRCode from 'qrcode';
import { t } from 'svelte-i18n';
type Props = {
value: string;
width: number;
alt?: string;
};
const { value, width, alt = $t('alt_text_qr_code') }: Props = $props();
let promise = $derived(QRCode.toDataURL(value, { margin: 4, width }));
</script>
<div style="width: {width}px; height: {width}px">
{#await promise then url}
<img src={url} {alt} class="h-full w-full" />
{/await}
</div>