Copyright 2019 - John Meister - http://johnmeister.com and http://linuxmeister.net ################################################################# #!/bin/bash ### # 2019-Nov-14 thumb - copied mkthumbpg to thumb to add .httaccess and use THUMB.html instead of index.html ### 12 Jan 2019 - updating to create index page, and ALL.html ### mkthumbpg # 18jan2019 - enhance using "convert" to create thumbnails for thumbnail page ### echo "convert -thumbnail 200 file.jpg file-T.jpg" ### mkpgit - create index and ALL pages to fix bad web filters - and "t" to add thumbnails ### 28 oct 2013 - john http://johnmeister.com - updated 8 may 2015 ### updated date in title to 2017 - 30 Dec 2016 - update 1jan2018 ### updating 12 Sep 2018 - not saving IMG.html, updating missing.html ### updated 2 Dec 2018 to include g7x and g3x ################################################################# # mkpg - creates a page to display all images in a directory ################################################################# CAT=/usr/bin/cat CP=/usr/bin/cp DATE=`date | cut -c 5-11` ; export DATE # echo $DATE FDATE=`/bin/date +%d%b%y-%H%M` ; export FDATE # echo $FDATE GREP=/usr/bin/grep GREPV="/usr/bin/grep -v" LS=/usr/bin/ls LSF="/usr/bin/ls -F" MKDIR=/usr/bin/mkdir MV=/usr/bin/mv PERL=/usr/bin/perl RM=/usr/bin/rm SED=/usr/bin/sed SORT=/usr/bin/sort TITLE="`echo "$1 $2 $3 $4 $5 $6 $7 $8 $9"`" ; export TITLE ; echo $TITLE UNIQU="/usr/bin/uniq -u" VI=/usr/bin/vi WCL="/usr/bin/wc -l" ############################################## # create backup copies of ALL, Header, Readme and footer files ############################################## $MKDIR z 2>/dev/null $MV ALL.html z/ALL.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV index.html z/index.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV THUMB.html z/THUMB.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV tindex.html z/tindex.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV README.html z/README-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV HEADER.html z/HEADER-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $MV FOOTER.html z/FOOTER-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null ############################################## $CP /home/luser/PAGES/README.html README.html $CP /home/luser/PAGES/HEADER.html HEADER.html ############################################## echo "$TITLE - john meister © 2019" > ALL.html echo "$TITLE - john meister © 2019" > index.html echo "$TITLE - john meister © 2019" > tindex.html $CAT /home/luser/bin/BASE/A >> ALL.html $CAT /home/luser/bin/BASE/A >> index.html $CAT /home/luser/bin/BASE/A >> tindex.html ############################################## echo "" >> ALL.html echo "" >> index.html echo "" >> tindex.html #### echo "
fotomeister © 2019
" >> index.html #### echo "

$TITLE

" >> ALL.html echo "
" >> index.html echo "
" >> tindex.html #### echo "

$TITLE

" >> index.html echo "

$TITLE

" >> tindex.html #### echo "
" >> index.html echo "
" >> tindex.html ############################################## # image tags and place D850, D750, P1000, canon files ############################################## $LS *.jpg > IMGs 2>/dev/null $LS *.JPG >> IMGs 2>/dev/null $CAT IMGs | $GREP JM8 > IMG.html 2>/dev/null $CAT IMGs | $GREP G7X >> IMG.html 2>/dev/null $CAT IMGs | $GREP G3X >> IMG.html 2>/dev/null $CAT IMGs | $GREP IMG >> IMG.html 2>/dev/null $CAT IMGs | $GREP DSCN >> IMG.html 2>/dev/null $CAT IMGs | $GREP JM7 >> IMG.html 2>/dev/null $CAT IMGs | $GREP JM6 >> IMG.html 2>/dev/null $CAT IMGs | $GREP D7K >> IMG.html 2>/dev/null $CAT IMGs | $GREP JEM >> IMG.html 2>/dev/null $LS *.jpg *.JPG 2>/dev/null | $GREP -v JM8 | $GREP -v G7X | $GREP -v G3X | $GREP -v JM7 | $GREP -v JM6 | $GREP -v DSCN | $GREP -v JEM | $GREP -v IMG >> IMG.html 2>/dev/null ############################################## $CP IMG.html LIMG.html # creating copy of sorted files for links for index.html $CP IMG.html LIMGT.html # creating copy of sorted files for links for tindex.html ############################################## $PERL -pi -e 's/(.*)/
$1
/g' IMG.html 2>/dev/null $PERL -pi -e 's/

//g' IMG.html 2>/dev/null ############################################## $CAT IMG.html >> ALL.html echo "" >> ALL.html $CAT /home/luser/bin/BASE/B >> ALL.html ############################################## $LSF | $GREP / | $GREPV z | $GREPV TN > DIRL.txt $SED -i.bak 's$/$$g' DIRL.txt $SED -i.bak 's$.*$&
$g' DIRL.txt 2>/dev/null $SED -i.bak 's$
$$g' DIRL.txt 2>/dev/null ############################################## $SED -i.bak 's$.*$&
$g' LIMG.html 2>/dev/null $SED -i.bak 's$
$$g' LIMG.html 2>/dev/null ############################################## echo "
select ALL.html to view all pictures in this directory: " >> index.html echo "ALL.html
" >> index.html echo "BACK one level
" >> index.html echo "all with thumbnails

" >> index.html echo "
" >> index.html $CAT LIMG.html >> index.html echo "

Additional Directories:
" >> index.html $CAT DIRL.txt >> index.html echo "
" >> index.html $CAT /home/luser/bin/BASE/B >> index.html ############################################## ### echo "convert -thumbnail 200 file.jpg t200-file.jpg" ############################################## $MKDIR TN 2>/dev/null for T in `cat LIMGT.html` do convert -thumbnail 200 $T TN/t200-$T done $SED -i.bak 's$.*$ - &$g' LIMGT.html 2>/dev/null $SED -i.bak 's$ - $$g' LIMGT.html 2>/dev/null ############################################# ##### alternate form of thumbnails if "convert -thumbnail 200 $T TN/t200-$T" is not available (p/o imagemagick) ##### $SED -i.bak 's$.*$ - &$g' LIMGT.html 2>/dev/null ##### $SED -i.bak 's$ - $$g' LIMGT.html 2>/dev/null ############################################## echo "
select ALL.html to view all pictures in this directory: " >> tindex.html echo "ALL.html
" >> tindex.html echo "BACK one level
" >> tindex.html echo "
" >> tindex.html $CAT LIMGT.html >> tindex.html echo "

" >> tindex.html echo "

Additional Directories:
" >> tindex.html $CAT DIRL.txt >> tindex.html echo "
" >> tindex.html #### echo "
fotomeister © 2019
" >> tindex.html #### $CAT /home/luser/bin/BASE/B >> tindex.html ############################################## $MV index.html THUMB.html echo "HeaderName THUMB.html" > .htaccess ############################################## $RM DIRL.txt z/DIRL.txt-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $RM IMG.html z/IMG.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $RM LIMG.html z/LIMG.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $RM LIMGT.html z/LIMGT.html-`/bin/date +%Y-%m-%d-%Hh%Mm` 2>/dev/null $RM IMGs $RM *.bak ############################################## # next step - create "titles" from current directory # home/luser/PAGES/2018/01-Jan-01-SuperMoon-MtVernon # ------------------------------------------------ # --> pwd | awk -F / '{print "directory: "$6" year: "$5 }' # directory: 01-Jan-01-SuperMoon-MtVernon year: 2018 ##############################################