From aa849d9eeae23eb7380d3152eece7c551f447779 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Tue, 24 Jan 2017 09:06:10 -0500 Subject: Add support for images. --- publish.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/publish.sh b/publish.sh index 2b223a2..c3f8d33 100755 --- a/publish.sh +++ b/publish.sh @@ -16,3 +16,22 @@ for input in ${INPUTS}; do mkdir -p $(dirname "$output") perl -pe "$filter" "$input" | pandoc -f org -s -t html5 -H static/header-ext.html -o "$output" done + +mkdir -p www/images +IMAGES=$(find input -regextype awk -iregex '.*\.(jpg|png)') +for image in ${IMAGES}; do + tmp="www${image#input}" + basepath=${tmp%.*} + extension=${image#*.} + + if [[ ! -f "${basepath}.${extension}" ]]; then + cp -v $image "${basepath}.${extension}" + fi + + for res in 640 1024 2048; do + target="${basepath}-${res}w.${extension}" + if [[ ! -f $target ]]; then + convert $image -resize $res $target + fi + done +done -- cgit v1.2.3