# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-set -e
set -f
-VERSION="1.1+arch"
+VERSION="1.1.1+arch"
function bpgallery_default_head() {
cat <<END
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>${TITLE}</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
+ <link rel="stylesheet" href="${BASEURL}style.css" type="text/css" />
</head>
<body>
END
<h1>${caption}</h1>
<div class="navigation">
<ul>
- <li><a href='${INDEXDOCUMENT}'>Thumbnails</a></li>
+ <li><a href='${BASEURL}${INDEXDOCUMENT}'>Thumbnails</a></li>
END
if [[ ! -z $previouspage ]]; then
$ECHOCOMMAND "<li><a href='${previouspage}'>Previous</a></li>"
GENERATEPAGESFORMEDIUMSIZE=1
fi
+if [[ -z $PAGESDIRECTORY ]]; then
+ PAGESDIRECTORY=""
+else
+ temp=${PAGESDIRECTORY:${#PAGESDIRECTORY}-1:1}
+ if [[ "x$temp" != "x/" ]] && [[ "x$temp" != "x\\" ]]; then
+ PAGESDIRECTORY=${PAGESDIRECTORY}/
+ fi
+fi
+
if [[ -z $MEDIUMWIDTH ]]; then
MEDIUMWIDTH=400
fi
else
nextpage=${nextimage}.html
fi
- filename=${extradir}${currentimage}
- echo "'$previouspage' '$currentpage' '$nextpage' '$addlink'" >> /tmp/bpgallery-tmp.log
+
+ if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ filename=../${extradir}${currentimage}
+ else
+ filename=${extradir}${currentimage}
+ fi
if [ "x$currentpage" != "x" ]; then
generate_general_page "$previouspage" "$currentpage" "$nextpage" $addlink
fi
else
addlink=${currentpage}
fi
-
- filename=${extradir}${currentpage}
+
+ if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ filename=../${extradir}${currentpage}
+ else
+ filename=${extradir}${currentpage}
+ fi
if [[ $addlinks == 1 ]]; then
currentpage=${currentpage}${extra}.html
previouspage=${previouspage}${extra}.html
function generate_general_page() {
- echo 'Generating the page...' >> /tmp/bpgallery-tmp.log
-
if [[ -z $1 ]]; then
previouspage=""
fi
fi
if [ -r captions.txt ]; then
- caption=$($GREPCOMMAND -E "^${filename} " captions.txt); caption=${caption#* }
+ imagefilename=${filename##*/}
+ caption=$($GREPCOMMAND -E "^${imagefilename} " captions.txt); caption=${caption#* }
else
caption=""
fi
- $BPGALLERY_PAGE_FUNCTION > "$currentpage"
+ $BPGALLERY_PAGE_FUNCTION > "${PAGESDIRECTORY}$currentpage"
}
if [[ $OUTPUTHTML != 0 ]]; then
generate_thumbs
+if [[ "x$PAGESDIRECTORY" != "x" ]]; then
+ if [ ! -d $PAGESDIRECTORY ]; then
+ mkdir -p $PAGESDIRECTORY
+ fi
+
+ if [ ! -w $PAGESDIRECTORY ]; then
+ $ECHOCOMMAND "Can't write to $PAGESDIRECTORY directory, exiting"
+ exit 16
+ fi
+
+ BASEURL="../"
+fi
+
if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then
generate_medium
generate_medium_pages
DESCRIPTION=""
fi
+BASEURL=""
$ECHOCOMMAND "Starting to generate page"
extra=__medium
fi
-$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | $SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}${extra}.html"); elif [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT}
+$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | $SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then link=${PAGESDIRECTORY}$(bpgallery_escape_url "${filename}${extra}.html"); elif [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=${PAGESDIRECTORY}$(bpgallery_escape_url "${filename}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT}
$BPGALLERY_TAIL_FUNCTION >> ${INDEXDOCUMENT}