-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from T0biii/master
add #3 (New-PSOneQRCodeURI)
- Loading branch information
Showing
4 changed files
with
65 additions
and
4 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,59 @@ | ||
function New-PSOneQRCodeURI | ||
{ | ||
<# | ||
.SYNOPSIS | ||
Creates a QR code graphic containing a URI | ||
.DESCRIPTION | ||
Creates a QR code graphic in png format that - when scanned by a smart device - opens a URI/URL in your webapp | ||
.PARAMETER URI | ||
The URI | ||
.PARAMETER Width | ||
Height and Width of generated graphics (in pixels). Default is 100. | ||
.PARAMETER Show | ||
Opens the generated QR code in associated program | ||
.PARAMETER OutPath | ||
Path to generated png file. When omitted, a temporary file name is used. | ||
.EXAMPLE | ||
New-PSOneQRCodeURI -URI "https://github.com/TobiasPSP/Modules.QRCodeGenerator" -Width 50 -Show -OutPath "$home\Desktop\qr.png" | ||
Creates a QR code png graphics on your desktop, and opens it with the associated program | ||
.NOTES | ||
Compatible with all PowerShell versions including PowerShell 6/Core | ||
Uses binaries from https://github.com/codebude/QRCoder/wiki | ||
.LINK | ||
https://github.com/TobiasPSP/Modules.QRCodeGenerator | ||
#> | ||
|
||
[CmdletBinding()] | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[alias("URL")] | ||
[System.Uri] | ||
$URI, | ||
|
||
[ValidateRange(10,2000)] | ||
[int] | ||
$Width = 100, | ||
|
||
[Switch] | ||
$Show, | ||
|
||
[string] | ||
$OutPath = "$env:temp\qrcode.png" | ||
) | ||
|
||
$payload = @" | ||
$($URI.AbsoluteUri) | ||
"@ | ||
|
||
New-PSOneQRCode -payload $payload -Show $Show -Width $Width -OutPath $OutPath | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,6 @@ New-QRCodeText | |
New-QRCodeTwitter | ||
New-QRCodeVCard | ||
New-QRCodeWifiAccess | ||
New-QRCodeURI | ||
``` | ||
|