Add shellscript that takes a list of JPG/PNG, extracts the EXIF, and creates thumbnails
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
45
mkgallery.sh
Executable file
45
mkgallery.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# set -x
|
||||||
|
|
||||||
|
BASE=~pim/Public/sabbatical.ipng.nl/static/img
|
||||||
|
|
||||||
|
[ -d $BASE ] || {
|
||||||
|
echo "Cannot find \$BASE directory"; exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ARR=()
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
FN=$1; shift
|
||||||
|
BN=$(basename $FN)
|
||||||
|
echo -n Processing $FN
|
||||||
|
DATE=$(identify -format '%[EXIF:*]' $FN | awk -F= '/exif:DateTime=/ { sub(" .*","",$2); gsub(":","-",$2); print $2 }')
|
||||||
|
if [[ $DATE == *"2024-"* ]]; then
|
||||||
|
mkdir -p $BASE/fullsize/$DATE $BASE/thumbnails/$DATE
|
||||||
|
magick $FN -resize 300x $BASE/thumbnails/$DATE/$BN
|
||||||
|
cp $FN $BASE/fullsize/$DATE/$BN
|
||||||
|
ARR+=($DATE/$BN)
|
||||||
|
echo "... done!"
|
||||||
|
else
|
||||||
|
echo "... skipping, no date found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Output the gallery for inclusion in the article
|
||||||
|
set +x
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
# Pictures of the Day
|
||||||
|
|
||||||
|
{{< gallery-category >}}
|
||||||
|
EOF
|
||||||
|
for pic in "${ARR[@]}"
|
||||||
|
do
|
||||||
|
echo " {{< gallery-photo fn=\"$pic\" caption=\"\" >}}"
|
||||||
|
done
|
||||||
|
cat << EOF
|
||||||
|
{{< /gallery-category >}}
|
||||||
|
|
||||||
|
{{< gallery-modal >}}
|
||||||
|
{{< gallery-script >}}
|
||||||
|
EOF
|
Reference in New Issue
Block a user