GoodAnalytics.Core.Links.QR (GoodAnalytics v0.1.1)

Copy Markdown View Source

Generates QR code images for short links.

QR codes encode {scheme}://{domain}{path_prefix}/{key}?qr=1 so that scans are detectable in the redirect flow. Rendered images are cached in Nebulex to avoid redundant generation.

Summary

Functions

Generates a QR code image for the given domain and key.

Functions

generate(domain, key, opts \\ [])

Generates a QR code image for the given domain and key.

Returns {:ok, binary} on success or {:error, reason} on failure. Checks the cache first; on miss, verifies the link exists in the DB.

Options

  • :format - :svg (default) or :png
  • :size - scale factor, 1..50 (default 10)
  • :fg - foreground color as 6-char hex string (default "000000")
  • :bg - background color as 6-char hex string (default "ffffff")
  • :ec - error correction level: "low", "medium", "quartile", "high" (default "low")
  • :path_prefix - short-link mount path prefix (default config :good_analytics, :link_path_prefix or "")