From 46ba08519b7d46f49f499d4a87ad06440a41cda8 Mon Sep 17 00:00:00 2001 From: Alban Date: Fri, 22 Nov 2019 23:02:46 +0100 Subject: [PATCH] [fix] bugs --- .gitignore | 2 + page_generator.sh | 8 +-- public/index.php | 144 ++++++++++++++++++++++++++++++++----- public/jq-ajax-progress.js | 75 +++++++++++++++++++ public/jquery.js | 2 + public/montage.php | 33 +++++++++ 6 files changed, 241 insertions(+), 23 deletions(-) create mode 100644 public/jq-ajax-progress.js create mode 100644 public/jquery.js create mode 100644 public/montage.php diff --git a/.gitignore b/.gitignore index 5e28f14..7a79054 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ images logs synthesis *swp +stamps +a4 diff --git a/page_generator.sh b/page_generator.sh index 113b6cf..f956071 100755 --- a/page_generator.sh +++ b/page_generator.sh @@ -17,8 +17,8 @@ read name type GEOMETRY canvas depth format size other <<< $( identify $IMG ) IMG_WIDTH=$( cut -d "x" -f 1 <<< $GEOMETRY ) IMG_HEIGHT=$( cut -d "x" -f 2 <<< $GEOMETRY ) -TOTAL_WIDTH=$( [[ -n "$LANDSCAPE" ]] && echo $LARGE_SIDE || echo $SMALL_SIDE ) -TOTAL_HEIGHT=$( [[ -n "$LANDSCAPE" ]] && echo $SMALL_SIDE || echo $LARGE_SIDE ) +TOTAL_WIDTH=$( [[ "$LANDSCAPE" == "1" ]] && echo $LARGE_SIDE || echo $SMALL_SIDE ) +TOTAL_HEIGHT=$( [[ "$LANDSCAPE" == "1" ]] && echo $SMALL_SIDE || echo $LARGE_SIDE ) REQ_WIDTH=$(( $TOTAL_WIDTH / $COUNT_HORIZONTAL )) REQ_HEIGHT=$(( $TOTAL_HEIGHT / $COUNT_VERTICAL )) @@ -26,9 +26,9 @@ REQ_HEIGHT=$(( $TOTAL_HEIGHT / $COUNT_VERTICAL )) DUP=$(( ( $COUNT_HORIZONTAL * $COUNT_VERTICAL ) - 1 )) DATE=$( date +%s ) -OUTPUT_DIR=/tmp +OUTPUT_DIR=$( dirname ~+ )/a4 FILENAME=$( basename $IMG ) PDF_NAME=${OUTPUT_DIR}/${DATE}_${FILENAME}.pdf -OUT=$( montage -tile ${COUNT_HORIZONTAL}x${COUNT_VERTICAL} -density 200x200 -units pixelspercentimeter -border 0 -page ${TOTAL_WIDTH}x${TOTAL_HEIGHT} "$IMG" -geometry ${REQ_WIDTH}x${REQ_HEIGHT} -duplicate ${DUP},0 ${PDF_NAME} ) +OUT=$( montage -tile ${COUNT_HORIZONTAL}x${COUNT_VERTICAL} -density 200x200 -units pixelspercentimeter -border 0 -page ${TOTAL_WIDTH}x${TOTAL_HEIGHT} -compress zip -quality 100 "$IMG" -geometry ${REQ_WIDTH}x${REQ_HEIGHT} -duplicate ${DUP},0 ${PDF_NAME} ) [ 0 -eq $? ] && echo $PDF_NAME || panic "An error occured... $OUT" diff --git a/public/index.php b/public/index.php index 1536d07..1aa9b30 100644 --- a/public/index.php +++ b/public/index.php @@ -3,19 +3,19 @@ $stampsImgList=scandir("../stamps"); foreach( $stampsImgList as $file ){ if( strpos( "$file", ".") != 0 ){ - $stampsSelect .= ""; + $name = ucwords(str_replace("_", " ",substr($file,0,-4))); + $stampsSelect .= ""; } } $bgdImgList = scandir("../synthesis"); $randomKeys = array_rand( $bgdImgList , 13 ); - $bgdSelect=""; + $bgdSelect=""; foreach( $randomKeys as $key ){ $file = $bgdImgList[ $key ]; if( strpos( "$file", ".") != 0 ){ $key = substr( $file, 11, -4 ); - // $bgdArr[$key] ="