From 352c6dde4d0b48525ec4586ea904457218a98dd6 Mon Sep 17 00:00:00 2001 From: "sh+git@codevoid.de" Date: Wed, 23 Oct 2019 12:31:49 +0000 Subject: [PATCH] More configuration options --- README | 15 ++++++++++++--- mkpicindex.sh | 28 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/README b/README index 342a6dc..051daa8 100644 --- a/README +++ b/README @@ -1,13 +1,22 @@ -Usage: +Usage (via Makefile): $ make +Usage: + + $ ./mkpicindex.sh > index.html + This will create a justified gallery with all jpg, png and gif pictures in the current directory. $ make clean -This will remove all autogenerated files including thumbnails. +This will remove all autogenerated files except the generated thumbnail +files. -Configure in `config.mk`. +Configuration can be done by altering `mkpicindex.sh`. Configuration +variables are at the top. + +You can create the files HEADER and FOOTER, which will be included +above and below the gallery. diff --git a/mkpicindex.sh b/mkpicindex.sh index 12ef001..4aa68ac 100755 --- a/mkpicindex.sh +++ b/mkpicindex.sh @@ -1,7 +1,7 @@ #!/bin/sh -printf '%s' ' -/*! +printf '%s' \ +'/*! * ISC License (ISC) * Copyright 2019 Stefan Hagen * @@ -30,8 +30,11 @@ printf '%s' ' # CONFIGURE GALLERY_TITLE="My Gallery" GALLERY_ROW_HEIGHT=150 +BODY_STYLE="color:orange; background:black;" THUMBNAIL_QUALITY=83 THUMBNAIL_PATH="thm" +INCLUDE_FOOTER="FOOTER" +INCLUDE_HEADER="HEADER" ### ZE PROGAM STARTZ HERE ############################################## cleanup() { @@ -44,17 +47,23 @@ trap cleanup 1 2 3 6 # CREATE THUMBNAIL DIRECTORY mkdir -p $THUMBNAIL_PATH +# INCLUDE CUSTOM HEADER & FOOTER +FOOTER=$([ -f $INCLUDE_FOOTER ] && cat $INCLUDE_FOOTER | sed 's/^/ /g') +HEADER=$([ -f $INCLUDE_HEADER ] && cat $INCLUDE_HEADER | sed 's/^/ /g') + # PRINT HEADER -printf '%s%s%s\n' ' +printf '%s%s%s%s%s\n' \ +' '"$GALLERY_TITLE"' - -
-' + +' "$HEADER"' +
' + # RESCALE AND PRINT IMAGE SOURCE # PARAM 1: original @@ -97,8 +106,8 @@ done ### MAIN LOOP END ###################################################### # PRINT FOOTER -printf '%s\n' " -
+printf '%s%s\n' \ +"
+" "$FOOTER " -# ASSETS (style.css, justify.js) ####################################### +### ASSETS (style.css, justify.js) ##################################### printf '%s' ' H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M MkMxeSCyKSGiAAYAtUTk+ey3ftULGgvlzNx738xYxNLotbq69jp+3jv67futzB+Obj8YfTga