diff options
| author | Jakob L. Kreuze | 2022-11-15 19:17:44 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze | 2022-11-15 19:17:44 -0500 |
| commit | 2c666a53e847e6b49dbdf4fd22416872bb197f6b (patch) | |
| tree | 9bacca9cdc0ee645941bc09b61d1d6a91d6f2678 /haunt/jakob/dynamic/import-images.sh | |
| parent | b6482d86fa58dee7d55889fa873463274f81d3db (diff) | |
[dynamic] Move to `haunt' directory and `jakob' namespace
There will likely be some refactoring later as part of this change, since we can
unify the `util' namespaces.
Diffstat (limited to 'haunt/jakob/dynamic/import-images.sh')
| -rw-r--r-- | haunt/jakob/dynamic/import-images.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/haunt/jakob/dynamic/import-images.sh b/haunt/jakob/dynamic/import-images.sh new file mode 100644 index 0000000..23f6130 --- /dev/null +++ b/haunt/jakob/dynamic/import-images.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +VANITY="$1" +shift + +for item in "$@"; do + filename=$(basename -- "$item") + extension="${filename##*.}" + filename="${filename%.*}" + uuid="$(uuidgen)" + cp "$item" "/home/jakob/gallery-images/$uuid.$extension" + convert "/home/jakob/gallery-images/$uuid.$extension" -thumbnail '100x100>' "/home/jakob/gallery-images/${uuid}_thumb.png" + psql jakob_gallery -c "INSERT INTO images (vanity, title, filename, thumb_filename, datetime) VALUES ('$VANITY', '$filename', '$uuid.$extension', '${uuid}_thumb.png', now());" +done |