Tidy things up
This commit is contained in:
parent
718f541621
commit
de651d0aa0
5
Makefile
5
Makefile
@ -1,7 +1,4 @@
|
|||||||
|
|
||||||
include config.mk
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
./mkpicindex.sh > index.html
|
./mkpicindex.sh > index.html
|
||||||
clean:
|
clean:
|
||||||
rm -rf ${THUMBNAIL_PATH} index.html style.css justify.js
|
rm -rf index.html style.css justify.js LICENSE
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
GALLERY_ROW_HEIGHT=150
|
|
||||||
THUMBNAIL_QUALITY=83
|
|
||||||
THUMBNAIL_PATH="thm"
|
|
@ -1,22 +1,53 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# READ CONFIG FILE
|
printf '%s' '
|
||||||
. $PWD/config.mk
|
/*!
|
||||||
|
* ISC License (ISC)
|
||||||
|
* Copyright 2019 Stefan Hagen
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
* any purpose with or without fee is hereby granted, provided that
|
||||||
|
* the above copyright notice and this permission notice appear in all
|
||||||
|
* copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
||||||
|
* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Used Software:
|
||||||
|
* justifiedGallery - v4.0.0-alpha
|
||||||
|
* http://miromannino.github.io/Justified-Gallery/
|
||||||
|
* Copyright (c) 2019 Miro Mannino
|
||||||
|
* Licensed under the MIT license.
|
||||||
|
*/
|
||||||
|
' > LICENSE
|
||||||
|
|
||||||
# CREATE THUMBNAIL DIRECTORY
|
# CONFIGURE
|
||||||
mkdir -p $THUMBNAIL_PATH
|
GALLERY_TITLE="My Gallery"
|
||||||
|
GALLERY_ROW_HEIGHT=150
|
||||||
|
THUMBNAIL_QUALITY=83
|
||||||
|
THUMBNAIL_PATH="thm"
|
||||||
|
|
||||||
trap cleanup 1 2 3 6
|
### ZE PROGAM STARTZ HERE ##############################################
|
||||||
cleanup() {
|
cleanup() {
|
||||||
# DELETE BROKEN IMAGES
|
# DELETE BROKEN IMAGES
|
||||||
printf '%s\n' "Removing incomplete thumbnails." >&2
|
printf '%s\n' "Removing incomplete thumbnails." >&2
|
||||||
find $THUMBNAIL_PATH -name "*_tmp.*" -exec rm -v "{}" \;
|
find $THUMBNAIL_PATH -name "*_tmp.*" -exec rm -v "{}" \;
|
||||||
}
|
}
|
||||||
|
trap cleanup 1 2 3 6
|
||||||
|
|
||||||
|
# CREATE THUMBNAIL DIRECTORY
|
||||||
|
mkdir -p $THUMBNAIL_PATH
|
||||||
|
|
||||||
# PRINT HEADER
|
# PRINT HEADER
|
||||||
printf '%s\n' '<html>
|
printf '%s%s%s\n' '<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Bimbos</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>
|
||||||
@ -33,7 +64,6 @@ add_image() {
|
|||||||
local FILE="$1"
|
local FILE="$1"
|
||||||
local THUMB="$THUMBNAIL_PATH/$2-$GALLERY_ROW_HEIGHT"
|
local THUMB="$THUMBNAIL_PATH/$2-$GALLERY_ROW_HEIGHT"
|
||||||
local EXT="$3"
|
local EXT="$3"
|
||||||
if ! [ -f "$FILE" ]; then return; fi;
|
|
||||||
printf '%s\n' "Adding image: $FILE" >&2
|
printf '%s\n' "Adding image: $FILE" >&2
|
||||||
if ! [ -f "$THUMB.$EXT" ] && [ "$FILE" != "$THUMB.$EXT" ];
|
if ! [ -f "$THUMB.$EXT" ] && [ "$FILE" != "$THUMB.$EXT" ];
|
||||||
then convert -quality $THUMBNAIL_QUALITY -sharpen 2x2 \
|
then convert -quality $THUMBNAIL_QUALITY -sharpen 2x2 \
|
||||||
@ -50,17 +80,18 @@ add_image() {
|
|||||||
|
|
||||||
### MAIN LOOP ##########################################################
|
### MAIN LOOP ##########################################################
|
||||||
|
|
||||||
# JPEG, PNG ORIGINAL -> JPEG THUMBNAIL
|
for file in *.*;
|
||||||
for file in *.{png,jpg,jpeg,PNG,JPG,JPEG};
|
|
||||||
do
|
do
|
||||||
# add_image <original> <thumbnail_basename> <thumnail_format>
|
if [ -f "$file" ];
|
||||||
add_image "$file" "${file%%.*}" "jpeg"
|
then
|
||||||
done
|
case $(printf '%s' ${file##*.} | tr '[:upper:]' '[:lower:]') in
|
||||||
|
jpg|jpeg|png)
|
||||||
# GIF ORIGINAL -> GIF THUMBNAIL
|
add_image "$file" "${file%%.*}" "jpeg" ;;
|
||||||
for file in *.{gif,GIF};
|
gif)
|
||||||
do
|
add_image "$file" "${file%%.*}" "gif" ;;
|
||||||
add_image "$file" "${file%%.*}" "gif"
|
*) printf '%s\n' "Ignoring: $file" >&2 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
### MAIN LOOP END ######################################################
|
### MAIN LOOP END ######################################################
|
||||||
@ -81,8 +112,6 @@ printf '%s\n' "
|
|||||||
</body>
|
</body>
|
||||||
</html>"
|
</html>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ASSETS (style.css, justify.js) #######################################
|
# ASSETS (style.css, justify.js) #######################################
|
||||||
printf '%s' '
|
printf '%s' '
|
||||||
H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M
|
H4sICOmjrl0AA2p1c3RpZnkuanMAvL15e9tGsi/8//spRIwPBzCblOgs9wwohI8jO4kz2e1M
|
||||||
|
Loading…
Reference in New Issue
Block a user