32 lines
556 B
Bash
32 lines
556 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
source .env
|
||
|
|
||
|
INPUT="${1}"
|
||
|
|
||
|
SIZES=(
|
||
|
"home:420"
|
||
|
"full:1024"
|
||
|
)
|
||
|
|
||
|
function img () {
|
||
|
convert "${1}" -colorspace LAB -filter Lanczos -resize ${3}x -strip -quality 86 -colorspace sRGB "${2}"
|
||
|
echo "${1} -> ${2}"
|
||
|
}
|
||
|
|
||
|
mkdir -p "${WWW}/img/"
|
||
|
mkdir -p "${PHOTOS}/"
|
||
|
|
||
|
for sizeRaw in ${SIZES[@]}; do
|
||
|
sizeName=$(echo $sizeRaw | awk -F':' '{print $1}')
|
||
|
size=$(echo $sizeRaw | awk -F':' '{print $2}')
|
||
|
name=$(basename "${1}")
|
||
|
name=${name%.*}
|
||
|
output="${WWW}/img/${name}_${size}.jpg"
|
||
|
img "${1}" "${output}" "${size}"
|
||
|
done
|
||
|
|
||
|
mv "${1}" "${PHOTOS}/"
|