Files
landing_page/automation/process-article-img.sh
T
treanandAndrey Vasnetsov 092697f71e Social preview (#88)
* added social previews and command to the preview generating script

* upd preview

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-11-01 12:52:13 +01:00

29 lines
827 B
Bash

#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Please provide a path to the image"
exit 1
fi
if [ -z "$2" ]; then
echo "Please provide an article name alias"
exit 1
fi
if [ ! -f "$1" ]; then
echo "File $1 does not exist"
exit 1
fi
IMG_DESTINATION="./qdrant-landing/static/articles_data/${2}/preview"
mkdir -p $IMG_DESTINATION
convert "$1" -resize 1200x630^ -gravity center -extent 1200x630 "${IMG_DESTINATION}/social_preview.jpg";
convert "$1" -resize 898x300^ -gravity center -extent 898x300 "${IMG_DESTINATION}/title.jpg";
convert "${IMG_DESTINATION}/title.jpg" -resize 530x145^ -gravity center -extent 530x145 "${IMG_DESTINATION}/preview.jpg";
cwebp -q 95 "${IMG_DESTINATION}/title.jpg" -o "${IMG_DESTINATION}/title.webp";
cwebp -q 95 "${IMG_DESTINATION}/preview.jpg" -o "${IMG_DESTINATION}/preview.webp";