#!/bin/bash siteroot="../2minNoods_siteroot" noodspp=40 mkdir -p "$siteroot/img/thumbs" pageno=1 noodcount=1 # html and css stolen from https://perfectmotherfuckingwebsite.com/ pageheader=''' 2minNoods

2minNoods


''' rm -v "$siteroot"/index.*.html echo '' > "$siteroot/index.html" ls *.jpg | sort -k2 -t'_' -r > "$siteroot/photolist.txt" while read i; do if [ -f "$i" ]; then if [ ! -f "$siteroot/img/$i" ]; then echo "Resizing $i" convert "$i" -quality 70 -strip -auto-orient -resize "960^>" "$siteroot/img/thumbs/$i" convert "$i" -quality 90 -strip -auto-orient -resize "2160^>" "$siteroot/img/$i" fi if [[ $noodcount -eq 1 ]]; then echo "$pageheader" > "$siteroot/index.$pageno.html" fi echo '

'"$(basename $i .jpg)"'


' >> "$siteroot/index.$pageno.html" ((noodcount++)) if [[ $noodcount -gt $noodspp ]]; then ((pageno++)) noodcount=1 fi fi done < "$siteroot/photolist.txt" for ((page=1;page<=pageno;page++)); do echo -n '' >> "$siteroot/index.$page.html" done echo "Searching for deleted images" for i in $siteroot/img/*.jpg; do pic="$(basename $i)" if ! grep -Fxq "$pic" "$siteroot/photolist.txt"; then rm -v "$siteroot/img/thumbs/$pic" "$siteroot/img/$pic" fi done rm -v "$siteroot/photolist.txt"