2021-01-24 19:21:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.1
|
|
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
|
|
################################################################################
|
|
|
|
# INSTALLER convert et qrencode: sudo apt install imagemagick qrencode
|
|
|
|
################################################################################
|
|
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
|
|
ME="${0##*/}"
|
|
|
|
############################################################################################################################################################
|
|
|
|
# ${MY_PATH}/G1BILLET_MAKE.sh "nu me ro test" "se cr et" 100 7sn9dKeCNEsHmqm1gMWNREke4YAWtNw8KG1YBSN8CmSh 97968583
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
NUMERO="$1"
|
|
|
|
SECRET="$2"
|
|
|
|
MONTANT="$3"
|
|
|
|
NOTERIB="$4"
|
|
|
|
UNIQID="$5"
|
2021-01-26 22:54:49 +01:00
|
|
|
STYLE="$6"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
|
|
|
if [[ "$NUMERO" == "" || "$SECRET" == "" || "$MONTANT" == "" || "$NOTERIB" == "" || "$UNIQID" == "" ]]
|
|
|
|
then
|
2022-02-19 17:42:15 +01:00
|
|
|
exit 1
|
2021-01-24 19:21:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p /tmp/g1billet/$UNIQID
|
|
|
|
BILLETNAME=$(echo $NUMERO | sed 's/ /_/g')
|
|
|
|
|
|
|
|
# Add ${MY_PATH}/images/logo.png (250px)
|
2021-01-26 22:54:49 +01:00
|
|
|
composite -compose Over -gravity SouthWest -geometry +50+50 -dissolve 70% "${MY_PATH}/images/logo${STYLE}.png" "${MY_PATH}/images/fond${STYLE}.jpg" "/tmp/${BILLETNAME}.jpg"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
|
|
|
# Prepare BILLET qrcode verification URL
|
2021-02-03 15:10:49 +01:00
|
|
|
qrencode -s 6 -o "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "$NOTERIB"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
|
|
|
# Add verification QRCode
|
2021-02-03 15:10:49 +01:00
|
|
|
composite -compose Over -gravity SouthEast -geometry +35+50 "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "/tmp/${BILLETNAME}.jpg" "/tmp/${BILLETNAME}.jpg"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
|
|
|
# Change June logo color
|
|
|
|
case "$MONTANT" in
|
2022-02-19 17:42:15 +01:00
|
|
|
1)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill grey -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill green -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
5)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill orange -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
10)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill blue -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
20)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill purple -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
50)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill red -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
100)
|
|
|
|
convert "${MY_PATH}/images/g1${STYLE}.png" -fuzz 20% -fill black -opaque '#e5912b' "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cp "${MY_PATH}/images/g1${STYLE}.png" "/tmp/g1billet/${UNIQID}/g1.png"
|
|
|
|
;;
|
2021-01-24 19:21:49 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Add June LOGO to Billet
|
2021-01-26 22:54:49 +01:00
|
|
|
composite -compose Over -gravity NorthEast -geometry +50+25 -dissolve 90% "/tmp/g1billet/${UNIQID}/g1.png" "/tmp/${BILLETNAME}.jpg" "/tmp/${BILLETNAME}.jpg"
|
2021-01-24 19:21:49 +01:00
|
|
|
|
2021-06-02 03:08:44 +02:00
|
|
|
# xbian style (ASTROPORT/KODI) + JEU
|
|
|
|
if [[ "${STYLE}" == "xbian" || "${STYLE}" == "jeu" ]]
|
2021-01-29 00:07:25 +01:00
|
|
|
then
|
2022-02-19 17:42:15 +01:00
|
|
|
# CREATE PSEUDO for Gchange.fr
|
|
|
|
XZUID=$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)
|
2022-02-19 17:57:58 +01:00
|
|
|
BOTTOM="VISA MadeInZion -- ASTROPORT ONE --"
|
2022-02-19 17:42:15 +01:00
|
|
|
else
|
|
|
|
XZUID="G1 BILLET"
|
|
|
|
BOTTOM="Porte Monnaie Libre!! https://gchange.fr https://cesium.app"
|
2021-01-29 00:07:25 +01:00
|
|
|
fi
|
|
|
|
|
2021-06-02 03:08:44 +02:00
|
|
|
|
|
|
|
if [[ "$MONTANT" != "___" ]]; then
|
2021-01-24 19:21:49 +01:00
|
|
|
convert -font 'Liberation-Sans' \
|
2021-01-31 01:26:14 +01:00
|
|
|
-pointsize 40 -fill black -draw 'text 70,50 "'"$XZUID"'"' \
|
2021-06-02 03:08:44 +02:00
|
|
|
-pointsize 120 -fill black -draw 'text 325,250 "'"$MONTANT DU"'"' \
|
2021-02-03 15:14:08 +01:00
|
|
|
-pointsize 20 -fill black -draw 'text 380,20 "'"${NOTERIB}"'"' \
|
2021-01-24 19:21:49 +01:00
|
|
|
-pointsize 30 -draw 'text 50,100 "'"Identifiant: $NUMERO"'"' \
|
|
|
|
-pointsize 22 -fill black -draw 'text 50,130 "'"Code Secret: $SECRET"'"' \
|
2021-01-29 00:15:23 +01:00
|
|
|
-pointsize 25 -fill black -draw 'text 150,440 "'"$BOTTOM"'"' \
|
2021-01-24 19:21:49 +01:00
|
|
|
"/tmp/${BILLETNAME}.jpg" "/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
2021-06-02 03:08:44 +02:00
|
|
|
else
|
|
|
|
convert -font 'Liberation-Sans' \
|
|
|
|
-pointsize 40 -fill black -draw 'text 70,60 "'"$XZUID"'"' \
|
|
|
|
-pointsize 20 -fill black -draw 'text 380,30 "'"${NOTERIB}"'"' \
|
|
|
|
-pointsize 30 -draw 'text 50,100 "'"Identifiant: $NUMERO"'"' \
|
|
|
|
-pointsize 22 -fill black -draw 'text 50,130 "'"Code Secret: $SECRET"'"' \
|
|
|
|
-pointsize 25 -fill black -draw 'text 150,440 "'"$BOTTOM"'"' \
|
|
|
|
"/tmp/${BILLETNAME}.jpg" "/tmp/g1billet/${UNIQID}/${BILLETNAME}.BILLET.jpg"
|
|
|
|
fi
|
2021-01-24 19:21:49 +01:00
|
|
|
|
|
|
|
rm -f /tmp/${BILLETNAME}.jpg
|
2021-05-21 00:44:19 +02:00
|
|
|
|
|
|
|
## TODO STORE XZUID & G1PUB into ASTROPORT/IPFS, as FUTURE travelers...
|