diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2022-08-23 20:48:38 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2022-08-28 11:43:07 -0400 |
| commit | 521129c88bf432b8755f1fe0a94be73c157d26fe (patch) | |
| tree | 5d4ea57a6e48d6a36850f50d42495f5c49a134c4 /dynamic | |
| parent | 17be9b49c47243fa1e97c4b458fed3261500aa00 (diff) | |
[dynamic] Add `import-images.sh' for image gallery
Diffstat (limited to 'dynamic')
| -rw-r--r-- | dynamic/import-images.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/dynamic/import-images.sh b/dynamic/import-images.sh new file mode 100644 index 0000000..23f6130 --- /dev/null +++ b/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 |