Update generate-qrcode.ps1

This commit is contained in:
Markus Fleschutz 2021-02-12 12:19:44 +01:00 committed by GitHub
parent a9d9abd9b9
commit 23612569c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,14 +6,15 @@
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
param([string]$Text = "", $ImageSize = "") param($Text = "", $ImageSize = "")
try {
if ($Text -eq "") { if ($Text -eq "") {
$Text = read-input "Enter text or URL" $Text = read-input "Enter text or URL"
} }
if ($ImageSize -eq "") { if ($ImageSize -eq "") {
$ImageSize = read-input "Enter image size (e.g. 500x500)" $ImageSize = read-input "Enter image size (e.g. 500x500)"
} }
$ECC = "M" # can be L, M, Q, H $ECC = "M" # can be L, M, Q, H
$QuietZone = 1 $QuietZone = 1
$ForegroundColor = "000000" $ForegroundColor = "000000"
@ -22,7 +23,6 @@ $FileFormat = "jpg"
$PathToRepo = "$PSScriptRoot/.." $PathToRepo = "$PSScriptRoot/.."
$NewFile = "$PathToRepo/Data/qrcode.jpg" $NewFile = "$PathToRepo/Data/qrcode.jpg"
try {
$WebClient = new-object System.Net.WebClient $WebClient = new-object System.Net.WebClient
$WebClient.DownloadFile(("http://api.qrserver.com/v1/create-qr-code/?data=" + $Text + "&ecc=" + $ECC +` $WebClient.DownloadFile(("http://api.qrserver.com/v1/create-qr-code/?data=" + $Text + "&ecc=" + $ECC +`
"&size=" + $ImageSize + "&qzone=" + $QuietZone + ` "&size=" + $ImageSize + "&qzone=" + $QuietZone + `