t* Simple Justified Gallery URI git clone git://git.codevoid.de/mkpicindex DIR Log DIR Files DIR Refs DIR README --- DIR commit 17d25987d3e034c4d029efd47bc9ca03bfba9a75 DIR parent 061a4e32601d5c7f2734a3b5d64cab28d506e9b3 URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de> Date: Wed, 23 Oct 2019 14:31:49 +0200 More configuration options Diffstat: M README | 15 ++++++++++++--- M mkpicindex.sh | 28 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 12 deletions(-) --- DIR diff --git a/README b/README t@@ -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. + +Configuration can be done by altering `mkpicindex.sh`. Configuration +variables are at the top. -Configure in `config.mk`. +You can create the files HEADER and FOOTER, which will be included +above and below the gallery. DIR diff --git a/mkpicindex.sh b/mkpicindex.sh t@@ -1,7 +1,7 @@ #!/bin/sh -printf '%s' ' -/*! +printf '%s' \ +'/*! * ISC License (ISC) * Copyright 2019 Stefan Hagen * t@@ -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() { t@@ -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' '<html> +printf '%s%s%s%s%s\n' \ +'<html> <head> <title>'"$GALLERY_TITLE"'</title> <meta name="viewport" content="width=device-width"> <link href="style.css" rel="stylesheet"> <script src="justify.js"></script> </head> - <body style="color:orange; background:black;"> - <div id="base"> -' + <body style="'"$BODY_STYLE"'"> +' "$HEADER"' + <div id="base">' + # RESCALE AND PRINT IMAGE SOURCE # PARAM 1: original t@@ -97,8 +106,8 @@ done ### MAIN LOOP END ###################################################### # PRINT FOOTER -printf '%s\n' " - </div> +printf '%s%s\n' \ +" </div> <script> \$(\"#base\").justifiedGallery({ rowHeight : $GALLERY_ROW_HEIGHT/0.8, t@@ -109,10 +118,11 @@ printf '%s\n' " margins : 3 }); </script> +" "$FOOTER </body> </html>" -# ASSETS (style.css, justify.js) ####################################### +### ASSETS (style.css, justify.js) ##################################### printf '%s' ' H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M MkMxeSCyKSGiAAYAtUTk+ey3ftULGgvlzNx738xYxNLotbq69jp+3jv67futzB+Obj8YfTga