More configuration options

This commit is contained in:
sh+git@codevoid.de 2019-10-23 12:31:49 +00:00
parent de651d0aa0
commit 352c6dde4d
2 changed files with 31 additions and 12 deletions

15
README
View File

@ -1,13 +1,22 @@
Usage: Usage (via Makefile):
$ make $ make
Usage:
$ ./mkpicindex.sh > index.html
This will create a justified gallery with all jpg, png and gif pictures This will create a justified gallery with all jpg, png and gif pictures
in the current directory. in the current directory.
$ make clean $ 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.

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
printf '%s' ' printf '%s' \
/*! '/*!
* ISC License (ISC) * ISC License (ISC)
* Copyright 2019 Stefan Hagen * Copyright 2019 Stefan Hagen
* *
@ -30,8 +30,11 @@ printf '%s' '
# CONFIGURE # CONFIGURE
GALLERY_TITLE="My Gallery" GALLERY_TITLE="My Gallery"
GALLERY_ROW_HEIGHT=150 GALLERY_ROW_HEIGHT=150
BODY_STYLE="color:orange; background:black;"
THUMBNAIL_QUALITY=83 THUMBNAIL_QUALITY=83
THUMBNAIL_PATH="thm" THUMBNAIL_PATH="thm"
INCLUDE_FOOTER="FOOTER"
INCLUDE_HEADER="HEADER"
### ZE PROGAM STARTZ HERE ############################################## ### ZE PROGAM STARTZ HERE ##############################################
cleanup() { cleanup() {
@ -44,17 +47,23 @@ trap cleanup 1 2 3 6
# CREATE THUMBNAIL DIRECTORY # CREATE THUMBNAIL DIRECTORY
mkdir -p $THUMBNAIL_PATH 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 # PRINT HEADER
printf '%s%s%s\n' '<html> printf '%s%s%s%s%s\n' \
'<html>
<head> <head>
<title>'"$GALLERY_TITLE"'</title> <title>'"$GALLERY_TITLE"'</title>
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<link href="style.css" rel="stylesheet"> <link href="style.css" rel="stylesheet">
<script src="justify.js"></script> <script src="justify.js"></script>
</head> </head>
<body style="color:orange; background:black;"> <body style="'"$BODY_STYLE"'">
<div id="base"> ' "$HEADER"'
' <div id="base">'
# RESCALE AND PRINT IMAGE SOURCE # RESCALE AND PRINT IMAGE SOURCE
# PARAM 1: original # PARAM 1: original
@ -97,8 +106,8 @@ done
### MAIN LOOP END ###################################################### ### MAIN LOOP END ######################################################
# PRINT FOOTER # PRINT FOOTER
printf '%s\n' " printf '%s%s\n' \
</div> " </div>
<script> <script>
\$(\"#base\").justifiedGallery({ \$(\"#base\").justifiedGallery({
rowHeight : $GALLERY_ROW_HEIGHT/0.8, rowHeight : $GALLERY_ROW_HEIGHT/0.8,
@ -109,10 +118,11 @@ printf '%s\n' "
margins : 3 margins : 3
}); });
</script> </script>
" "$FOOTER
</body> </body>
</html>" </html>"
# ASSETS (style.css, justify.js) ####################################### ### ASSETS (style.css, justify.js) #####################################
printf '%s' ' printf '%s' '
H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M
MkMxeSCyKSGiAAYAtUTk+ey3ftULGgvlzNx738xYxNLotbq69jp+3jv67futzB+Obj8YfTga MkMxeSCyKSGiAAYAtUTk+ey3ftULGgvlzNx738xYxNLotbq69jp+3jv67futzB+Obj8YfTga