Add script to statically generate thumbnails

This commit is contained in:
Luca 2019-10-23 22:28:55 +02:00 committed by Florian Festi
parent 7ee2f7c405
commit 53374de766
36 changed files with 68 additions and 0 deletions

34
scripts/gen_thumbnails.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
set -e
STATIC_DIR=../static/samples/
THUMB_WIDTH=200
THUMB_HEIGHT=10000 # height: auto;
thumbnail() {
echo "convert \"$1\" -thumbnail ${THUMB_WIDTH}x${THUMB_HEIGHT} \"${1%.*}-thumb.jpg\""
convert "$1" -thumbnail ${THUMB_WIDTH}x${THUMB_HEIGHT} "${1%.*}-thumb.jpg"
}
[ ! -f "$STATIC_DIR"samples.sha256 ] && touch "$STATIC_DIR"samples.sha256
find "$STATIC_DIR" -name '*.jpg' ! -name '*-thumb.jpg' -type f | while read -r f
do
f_=$(echo "$f" | sed -E -e 's@([/.])@\\\1@g')
checksum=$(grep "$f_" "$STATIC_DIR"samples.sha256 || /bin/true)
if [ -n "$checksum" ]
then
echo "$checksum" | sha256sum -c --status || {
echo "File $f changed"
sed -i "/$f_/ c\\
$(sha256sum "$f")
" "$STATIC_DIR"samples.sha256
thumbnail "$f"
}
else
echo "New file $f"
sha256sum "$f" >> "$STATIC_DIR"samples.sha256
thumbnail "$f"
fi
done

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,34 @@
d8ee1417e2c0534e1f03a7ff8ce065672d2d127acacf3302c6131885528c1849 ../static/samples/Folder-2.jpg
31797aa9a37459d7e2b6c336b970efb3b73c9cc0dfc6e7b601237482e1fe8f23 ../static/samples/DisplayShelf.jpg
0af0fece21febabf8c96b687d43b15df39b176cd40db7d118689fb724bec1026 ../static/samples/FlexBox2.jpg
a7eb57748d9a6e1fcd6d71a261e20c4494047f2a5535e15164e77b2a070c02c8 ../static/samples/IntegratedHingeBox.jpg
3e147f6566ee95b07066531f6d2aff0e39c06a0eb6b463b596e8a125abeba2d2 ../static/samples/TwoPiece.jpg
168c2730dd5b184f14123e11d1648857d4740134ea39a2799cd86a318f943d5f ../static/samples/DividerTray.jpg
571324b0a4d2f8a0fc88f6ffb3358e658c9db9226ce51180dbf8fdcc0d10770b ../static/samples/TrayInsert-2.jpg
ae525120cb689c3ba3fb342707dd2ef784ae327b73e1ad207b63e971ae2fe447 ../static/samples/Stachel.jpg
7f513ac41d6a7dfef10f0dd5419bc36f8189b9896cf6bdd20958c6b691fc765c ../static/samples/TrayLayout.jpg
d91657ccae7b021fb0b329e0db856f0543f96d80eb090223ddfd1cc092ff82d0 ../static/samples/OpenBox.jpg
9a2a7a6585e6617752f523b988c28034a6e22e1632cc2602640f82efaafa5973 ../static/samples/Folder.jpg
47ca9ed38d02c57f2f3414a4da30ae853897c4aa6f8bc4b4317ccaee779b9e48 ../static/samples/UBox.jpg
544070ccee48bd9ca1c29f76064c6e545a2a30505bb6370e17aab7c3f64d0a91 ../static/samples/UniversalBox.jpg
992470664a50d616df1e7ca7a23698d21e0e59cb78b384c462ee5d1a0d03db89 ../static/samples/OttoBody.jpg
5967abbb795cae15f56c20438ca06a8fcd818559e3736cdf24d22c3359cb715a ../static/samples/RobotArm.jpg
0644ab61e34b495080362c3297b016be5f668537e48f3139d375e4edfbfbf425 ../static/samples/UnevenHeightBox.jpg
ad0b7b63e2398f0f57362befb9711776e902724d392f63d68e50350099650c8b ../static/samples/CardBox.jpg
fc4cc29e980c9e232527940fe4e65402d161a32719d060dfd5bee347466a435d ../static/samples/ShutterBox.jpg
873ef5c79fd7ef5a205b0adf6268a5a6a72aab92e0914f5a3687ab72f336b25e ../static/samples/AngledBox.jpg
09f74f4cf396d71b1fbe1e5529fde6212aefd89de6a267677aa2795df496cdb7 ../static/samples/ClosedBox.jpg
725a5853d339c742ddb9e671c627b2edfe160d69550ac9482d95366f08cb58f6 ../static/samples/DiscRack.jpg
e41545bfac4b05f2ab1b9f7b15b48c9ad5fb78cb9092c21bc33549164f3abd0d ../static/samples/RoundedBox.jpg
d4bcdd4ec8a16498970e869028adbedf73a12d08976e92fbc157ab547e2b3f9b ../static/samples/TrafficLight.jpg
67d7d9d44231f3c2a8250ca583f1b0d2ebe603d5d60f3ca39a3df3e924ab6a1d ../static/samples/FlexBox3.jpg
d379ca6b6fcd1d638de518a89d830e02492d56525c172bcd8a78fb7c161821f8 ../static/samples/TrayInsert.jpg
9b5377229375c4f70c6625c0e76921f3dc9183244bd387cb58ad450c0392ec66 ../static/samples/FlexBox4.jpg
68ae1564d8195c90e5ac168d0b7073ac35ced3cfab1500f5c1328a2704acf7b8 ../static/samples/FlexBox.jpg
205f5b5358a846ddf669a981da1fabc2ae0bb1119d04bd1d9c738e6763590ccc ../static/samples/DisplayCase.jpg
45e4c77a4a372b58dd896b477130f1a9f66ec96328b10e90a5c85a5810ed89f8 ../static/samples/HingeBox.jpg
e40055408c139c68c97c79a5b1671b6c66c1b12c2747a41efa7fe119328fec83 ../static/samples/StorageShelf.jpg
03fda7c7acee32437a9384a746f792cea8ae1cc333adfea581ba7831ec4469a9 ../static/samples/RegularBox.jpg
e9868a1cbccda0f4d0780ebf94cbb6f4817409e9298210aa5db9c61c5f755ac0 ../static/samples/TypeTray.jpg
f52a91a2140b856de6fb76966e7c247156031dd6e8287a601562f89f9426877a ../static/samples/March36539-box.jpg
6bc133b50fab351da3905441390d24f6800f5b477e2444672ca53c60d02a7cbb ../static/samples/BinTray.jpg