forked from gohugoio/hugo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes gohugoio#13205
- Loading branch information
Showing
5 changed files
with
157 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: images.QR | ||
description: Encodes the given text into a QR code, returning an image resource. | ||
categories: [] | ||
keywords: [] | ||
action: | ||
aliases: [] | ||
related: [] | ||
returnType: images.ImageResource | ||
signatures: ['images.QR TEXT [LEVEL]'] | ||
--- | ||
|
||
{{< new-in 0.141.0 >}} | ||
|
||
The `images.QR` function encodes the given text to a [QR code] using the given error correction level, returning an image resource. | ||
|
||
[QR code]: https://en.wikipedia.org/wiki/QR_code | ||
|
||
The default error correction level is sufficient for most applications. | ||
|
||
Error correction level|Image size (pixels)|Redundancy | ||
:--|:--|:-- | ||
low|232x232|20% | ||
medium (default)|264x264|38% | ||
quartile|264x264|55% | ||
high|296x296|65% | ||
|
||
To render a QR code with the default error correction level: | ||
|
||
```go-html-template | ||
{{ with images.QR "https://gohugo.io" }} | ||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> | ||
{{ end }} | ||
``` | ||
|
||
To render a QR code with a "high" error correction level: | ||
|
||
```go-html-template | ||
{{ with images.QR "https://gohugo.io" "high" }} | ||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> | ||
{{ end }} | ||
``` | ||
|
||
Always test the rendered QR code after resizing, both on-screen and in print. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters