commit ad88536911040763150f4ba90422e9243e25a5b2 Author: Simon Vieille Date: Sat Jan 7 18:32:57 2023 +0100 add micro website diff --git a/bin/create-json b/bin/create-json new file mode 100755 index 0000000..d54dc50 --- /dev/null +++ b/bin/create-json @@ -0,0 +1,64 @@ +#!/bin/sh + +usage() { + printf "Usage: %s -s SRC -o OUTPUT -b BASE_URL\n" "$0" +} + +on_interrupt() { + print "Process aborted!\n" + + exit 130 +} + +main() { + while getopts "hs:b:o:" option; do + case "${option}" in + h) usage; exit 0;; + s) SRC="$OPTARG";; + o) OUTPUT="$OPTARG";; + b) BASE_URL="$OPTARG";; + *) usage; exit 1;; + esac + done + + if [ -z "$SRC" ]; then + printf "You must provided the source (directory).\n" + usage + exit 1 + fi + + if [ -z "$OUTPUT" ]; then + printf "You must provided the output (json file).\n" + usage + exit 1 + fi + + if [ -z "$BASE_URL" ]; then + printf "You must provided the base url.\n" + usage + exit 1 + fi + + images="" + + for image in "$SRC/"*; do + filename="$(basename "$image")" + date="$(printf "%s" "$filename" | sed 's#^\([[:digit:]]\{4\}\)\([[:digit:]]\{2\}\)\([[:digit:]]\{2\}\)_.*$#\3/\2/\1#')" + images="$( + printf '%s%s{"file":"%s/%s","date":"%s"}' \ + "$images" \ + "$(test -n "$images" && printf ",")" \ + "$BASE_URL" \ + "$filename" \ + "$date" + )" + done + + printf '{"images":[%s]}' "$images" > "$OUTPUT" + + exit 0 +} + +trap on_interrupt INT + +main "$@" diff --git a/bin/create-thumbs b/bin/create-thumbs new file mode 100755 index 0000000..6829aa9 --- /dev/null +++ b/bin/create-thumbs @@ -0,0 +1,51 @@ +#!/bin/sh + +usage() { + printf "Usage: %s -s SRC -d DEST\n" "$0" +} + +on_interrupt() { + print "Process aborted!\n" + + exit 130 +} + +create_thumb() { + input="$1" + output="$2" + + test -f "$input" && convert "$input" -scale 1400x "$output" +} + +main() { + while getopts "hs:d:" option; do + case "${option}" in + h) usage; exit 0;; + s) SRC="$OPTARG";; + d) DEST="$OPTARG";; + *) usage; exit 1;; + esac + done + + if [ -z "$SRC" ]; then + printf "You must provided the source (directory).\n" + usage + exit 1 + fi + + if [ -z "$DEST" ]; then + printf "You must provided the destination (directory).\n" + usage + exit 1 + fi + + for image in "$SRC/"*; do + create_thumb "$image" "$DEST/$(basename "$image")" + done + + exit 0 +} + +trap on_interrupt INT + +main "$@" diff --git a/images/src/.gitkeep b/images/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/images/thumbs/.gitkeep b/images/thumbs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..a31f05c --- /dev/null +++ b/index.html @@ -0,0 +1,119 @@ + + + + +Diaporama + + + + +
+
+
+ +
+
+ Chargement en cours ({{ parseInt(100 * imagesLoaded / imagesToLoad) }}%) +
+ +
+
+
+ +
+
+
+
+ + + + + + + +