Created
December 12, 2022 15:35
-
-
Save robkooper/de2480454daceb5550a51b718a3f58b5 to your computer and use it in GitHub Desktop.
Script to create a QR code using qrcode-tiger.com
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
!/bin/bash | |
# https://www.qrcode-tiger.com/api-documentation | |
# /api/qr/static | |
API_KEY="SECRET" | |
FRAME_COLOR="#054080" | |
EYE_COLOR="#ff6500" | |
qr () { | |
image="$1" | |
title="$2" | |
url="$3" | |
if [ ! -e logo.json ]; then | |
curl --request POST -o logo.json \ | |
--url https://qrtiger.com/accounts/uploads/ \ | |
--header "Authorization: Bearer ${API_KEY}" \ | |
--header 'Content-Type: multipart/form-data' \ | |
--form '[email protected]' | |
fi | |
LOGO=$(jq -r .qrUrl logo.json) | |
if [ ! -e ${image}.png ]; then | |
cat > ${image}.req.json << EOF | |
{ | |
"qrCategory": "url", | |
"text": "${url}", | |
"size": 500, | |
"logo": "${LOGO}", | |
"colorDark": "${FRAME_COLOR}", | |
"eye_color": true, | |
"eye_color01": "${FRAME_COLOR}", | |
"eye_color02": "${EYE_COLOR}", | |
"eye_outer": "eyeOuter2", | |
"eye_inner": "eyeInner1", | |
"qrData": "pattern0", | |
"backgroundColor": "white", | |
"transparentBkg": false | |
} | |
EOF | |
# "frame": 1, | |
# "frameColor": "${FRAME_COLOR}", | |
# "frameText": "${title}" | |
curl --request POST -o ${image}.res.json \ | |
--url https://qrtiger.com/api/qr/static \ | |
--header "Authorization: Bearer ${API_KEY}" \ | |
--header 'Content-Type: application/json' \ | |
--data @${image}.req.json | |
jq -r .data ${image}.res.json| base64 -d > ${image}.png | |
fi | |
} | |
qr "groupme" "GroupMe" "https://groupme.com/join_group/XXXX" | |
qr "concessions" "Concessions" "https://www.signupgenius.com/go/XXXX" | |
qr "schedule" "Schedule" "https://prod-web-alb.8to18.com/Urbana/schedule/soccer/b/all/2022-2023" | |
qr "booster" "Booster" "https://forms.gle/XXXX" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment