style=ticket (Fanch le colporteur)
This commit is contained in:
parent
a4a6d77c81
commit
bd8d6c3f3e
32
G1BILLETS.sh
32
G1BILLETS.sh
|
@ -9,7 +9,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
ME="${0##*/}"
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create and print 6 G1Billets de $MONTANT DU
|
# Create and print 6 G1Billets de $MONTANT DU
|
||||||
# ${MY_PATH}/G1BILLETS.sh 5 986397643
|
# ${MY_PATH}/G1BILLETS.sh 5 986397643 ticket
|
||||||
################################################################################
|
################################################################################
|
||||||
MONTANT="$1"
|
MONTANT="$1"
|
||||||
UNIQID="$2"
|
UNIQID="$2"
|
||||||
|
@ -21,7 +21,9 @@ NBbillets=6
|
||||||
[[ $MONTANT == "" ]] && MONTANT="___"
|
[[ $MONTANT == "" ]] && MONTANT="___"
|
||||||
[[ $UNIQID == "" ]] && UNIQID=$(date -u +%s%N | cut -b1-13)$RANDOM
|
[[ $UNIQID == "" ]] && UNIQID=$(date -u +%s%N | cut -b1-13)$RANDOM
|
||||||
[[ "$STYLE" == "xbian" ]] && NBbillets=1 ## STYLE=xbian => 1 BILLET
|
[[ "$STYLE" == "xbian" ]] && NBbillets=1 ## STYLE=xbian => 1 BILLET
|
||||||
[[ "$STYLE" == "1" ]] && NBbillets=1 && STYLE="" ## 1 BILLET
|
[[ "$STYLE" == "1" ]] && NBbillets=1 && STYLE="" ## 1 BILLET PDF
|
||||||
|
[[ "$STYLE" == "ticket" ]] && NBbillets=1 && echo "TICKET" ## 1 BILLET JPG
|
||||||
|
|
||||||
|
|
||||||
# CHECK IF $STYLE IMAGES EXIST
|
# CHECK IF $STYLE IMAGES EXIST
|
||||||
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && exit 1
|
[[ ! -f ${MY_PATH}/images/fond${STYLE}.jpg ]] && exit 1
|
||||||
|
@ -46,15 +48,23 @@ do
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# MONTAGE DES IMAGES DES BILLETS VERS /tmp/g1billet/${UNIQID}.pdf
|
if [[ "${STYLE}" != "ticket" ]]
|
||||||
montage /tmp/g1billet/${UNIQID}/*.jpg -tile 2x3 -geometry 964x459 /tmp/g1billet/${UNIQID}.pdf
|
then
|
||||||
# NB!! if "not autorized" then edit /etc/ImageMagick-6/policy.xml and comment
|
# MONTAGE DES IMAGES DES BILLETS VERS /tmp/g1billet/${UNIQID}.pdf
|
||||||
# <!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
|
montage /tmp/g1billet/${UNIQID}/*.jpg -tile 2x3 -geometry 964x459 /tmp/g1billet/${UNIQID}.pdf
|
||||||
|
# NB!! if "not autorized" then edit /etc/ImageMagick-6/policy.xml and comment
|
||||||
|
# <!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
|
||||||
|
# CLEANING TEMP FILES
|
||||||
|
rm -Rf /tmp/g1billet/${UNIQID}
|
||||||
|
# ALLOWS ANY USER TO DELETE
|
||||||
|
chmod 777 /tmp/g1billet/${UNIQID}.pdf
|
||||||
|
else
|
||||||
|
cp /tmp/g1billet/${UNIQID}/*.jpg /tmp/g1billet/${UNIQID}.jpg
|
||||||
|
# CLEANING TEMP FILES
|
||||||
|
rm -Rf /tmp/g1billet/${UNIQID}
|
||||||
|
# ALLOWS ANY USER TO DELETE
|
||||||
|
chmod 777 /tmp/g1billet/${UNIQID}.jpg
|
||||||
|
fi
|
||||||
|
|
||||||
# CLEANING TEMP FILES
|
|
||||||
rm -Rf /tmp/g1billet/${UNIQID}
|
|
||||||
|
|
||||||
# ALLOWS ANY USER TO DELETE
|
|
||||||
chmod 777 /tmp/g1billet/${UNIQID}.pdf
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -32,10 +32,10 @@ BILLETNAME=$(echo $NUMERO | sed 's/ /_/g')
|
||||||
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"
|
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"
|
||||||
|
|
||||||
# Prepare BILLET qrcode verification URL
|
# Prepare BILLET qrcode verification URL
|
||||||
qrencode -s 5 -o "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "$NOTERIB"
|
qrencode -s 6 -o "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "$NOTERIB"
|
||||||
|
|
||||||
# Add verification QRCode
|
# Add verification QRCode
|
||||||
composite -compose Over -gravity SouthEast -geometry +45+60 "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "/tmp/${BILLETNAME}.jpg" "/tmp/${BILLETNAME}.jpg"
|
composite -compose Over -gravity SouthEast -geometry +35+50 "/tmp/g1billet/${UNIQID}/${BILLETNAME}.QR.png" "/tmp/${BILLETNAME}.jpg" "/tmp/${BILLETNAME}.jpg"
|
||||||
|
|
||||||
# Change June logo color
|
# Change June logo color
|
||||||
case "$MONTANT" in
|
case "$MONTANT" in
|
||||||
|
|
14
index.php
14
index.php
|
@ -5,16 +5,22 @@ $timestamp = $mytime->format('U').rand();
|
||||||
// CREATE 6 G1BILLETS in /tmp/g1billet/$timestamp
|
// CREATE 6 G1BILLETS in /tmp/g1billet/$timestamp
|
||||||
$page = shell_exec(dirname(__FILE__)."/G1BILLETS.sh '".$_REQUEST['montant']."' '".$timestamp."' '".$_REQUEST['style']."'");
|
$page = shell_exec(dirname(__FILE__)."/G1BILLETS.sh '".$_REQUEST['montant']."' '".$timestamp."' '".$_REQUEST['style']."'");
|
||||||
|
|
||||||
$attachment_location = "/tmp/g1billet/".$timestamp.".pdf";
|
if ( $_REQUEST['style'] == 'ticket' ) {
|
||||||
|
$file_type = "jpg";
|
||||||
|
} else {
|
||||||
|
$file_type = "pdf";
|
||||||
|
}
|
||||||
|
$attachment_location = "/tmp/g1billet/".$timestamp.".".$file_type;
|
||||||
|
|
||||||
if (file_exists($attachment_location)) {
|
if (file_exists($attachment_location)) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
|
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
|
||||||
header("Cache-Control: public"); // needed for internet explorer
|
header("Cache-Control: public"); // needed for internet explorer
|
||||||
header("Content-Type: application/pdf");
|
header("Content-Type: application/".$file_type);
|
||||||
header("Content-Transfer-Encoding: Binary");
|
header("Content-Transfer-Encoding: Binary");
|
||||||
header("Content-Length:".filesize($attachment_location));
|
header("Content-Length:".filesize($attachment_location));
|
||||||
header("Content-Disposition: attachment; filename=".$timestamp.".pdf");
|
header("Content-Disposition: attachment; filename=".$timestamp.".".$file_type);
|
||||||
readfile($attachment_location);
|
readfile($attachment_location);
|
||||||
unlink("/tmp/g1billet/".$timestamp.".pdf");
|
unlink("/tmp/g1billet/".$timestamp.".".$file_type);
|
||||||
die();
|
die();
|
||||||
} else {
|
} else {
|
||||||
die("Error: File not found.");
|
die("Error: File not found.");
|
||||||
|
|
Loading…
Reference in New Issue