#!/bin/sh ## ## SCRIPT: htm00_multi-img-files_small-img-TableCELLS_NperRow_echo_for-loop.sh ## ## PURPOSE: Generate an HTML file showing small (less than 160 pixels high/wide) ## image files IN ROWS down the page --- in table rows, N cells per row ## --- using the selected image files ('.jpg' , '.gif' or whatever). ## ## METHOD: Uses 'zenity --entry' to prompt for N (the number of cells per row). ## ## Uses 'echo' to generate the lines of the HTML file. ## ## This script shows the HTML file in an html-viewer of the user's choice ## ($HTMLVIEWER), and puts the user in edit mode on the HTML file ## using a text-editor of the user's choice ($TEXTEDITOR). ## ## HOW TO USE: In Nautilus, select one or more image files in a directory. ## Then right-click and select this script to run (name above). ## ## This script puts the '.htm' HTML file in the directory ## with the image files. ## ############################################################################# ## Started: 2011nov21 Based on 00_GENpage_thumbTableCells_SELimgFiles_NperRow.sh ## Changed: 2012may14 Changed script name in comments above and touched up ## the comments. Changed some indenting below. ########################################################################### ## FOR TESTING: (show statements as they execute) # set -x ################################################## ## Set the HTMLVIEWER and TXTEDITOR env vars. ################################################## ## . $HOME/.gnome2/nautilus-scripts/.set_VIEWERvars.shi . $HOME/.freedomenv/feNautilusScripts/set_DIR_NautilusScripts.shi . $DIR_NautilusScripts/.set_VIEWERvars.shi ################################################## ## Get N, the number of image-cells per row. ################################################## CELLSperROW="" CELLSperROW=$(zenity --entry \ --title "N - number of image-cells per row" \ --text "\ ENTER the desired NUMBER of image-cells PER ROW : Typically use 4, 5, or 6 --- depending on the 'small' image sizes. A '.htm' file will be created in the current directory --- and it will be shown in an HTMLVIEWER: $HTMLVIEWER and it will be shown in a TXTEDITOR: $TXTEDITOR" \ --entry-text "6") if test "$CELLSperROW" = "" then exit fi ################################### ## Set the HTML output file name. ################################### HTMFILE="00_temp_imgTableCells_smallImages_${CELLSperROW}perRow.htm" if test -f "$HTMFILE" then rm "$HTMFILE" fi ##################################################### ## Put the (skeleton) 'head', 'title', and 'intro' ## sections in the HTML file. ##################################################### echo "
Title Goes Heresubtitle goes here |
To download an image, you can right-click on an image and use an option like 'Save Image As ...' in the popup menu of your web browser. |
START of IMAGES :
$ROWID | " >> "$HTMFILE"
###############################################################
## IF exactly AT END OF ROW, write out table-row-end indicator.
###############################################################
if test `expr $FILECNT % $CELLSperROW` = 0
then
echo "
| " >> "$HTMFILE"
FILECNT=`expr $FILECNT + 1`
done
echo "
" >> "$HTMFILE"
fi
###################################################
## After writing out remaining cells (empty, if any)
## in the last row, write the bottom-of-page block.
###################################################
echo "
Bottom of the Title Goes Here page.
To return to a previously visited web page location, click on the
< Go to Start of Images, above. >
|