version 1.1, 2012/08/27 14:23:59
|
version 1.5, 2012/08/28 10:44:41
|
Line 5
|
Line 5
|
# can do whatever you want with this stuff. If we meet some day, and you think |
# can do whatever you want with this stuff. If we meet some day, and you think |
# this stuff is worth it, you can buy me a beer in return Aron Schlesinger |
# this stuff is worth it, you can buy me a beer in return Aron Schlesinger |
# |
# |
# $Paefchen$ | # $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.4 2012/08/28 08:43:05 as Exp $ |
# |
# |
|
|
ARG_TITLE="PGallery" |
ARG_TITLE="PGallery" |
Line 19 ARG_INDEX="index.html"
|
Line 19 ARG_INDEX="index.html"
|
ARG_DIR="." |
ARG_DIR="." |
ARG_UPDATE=1 |
ARG_UPDATE=1 |
ARG_COPYRIGHT="© $(date +%Y)" |
ARG_COPYRIGHT="© $(date +%Y)" |
|
ARG_INFOFILE="pgallery.txt" |
|
|
BIN_CONVERT="/usr/local/bin/convert" |
BIN_CONVERT="/usr/local/bin/convert" |
BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran" |
BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran" |
BIN_IMGINFO="/usr/local/bin/imginfo" |
BIN_IMGINFO="/usr/local/bin/imginfo" |
|
|
MKAKEFILE=".htmakefile" |
MKAKEFILE=".htmakefile" |
VERSION="pgallery-1" | VERSION="pgallery-1.1" |
|
|
# |
# |
# usage() |
# usage() |
Line 36 usage()
|
Line 37 usage()
|
usage $0: ( [-f <files>] | [-s <suffix>] ) [-d <dir>] [-n <name>] |
usage $0: ( [-f <files>] | [-s <suffix>] ) [-d <dir>] [-n <name>] |
[-t <thumbnail_size>] [-u <thumbnail_quality>] |
[-t <thumbnail_size>] [-u <thumbnail_quality>] |
[-b <big_size>] [-c <big_quality>] |
[-b <big_size>] [-c <big_quality>] |
[-i <index>] [-U] | -h | [-i <index>] [-C <copyright>] [-U] | -h | -v |
Options: |
Options: |
-b size size from big images in pixel (default: $ARG_BIGSIZE) |
-b size size from big images in pixel (default: $ARG_BIGSIZE) |
-c quality quality from big images 0-100% (default: $ARG_BIGQALITY) |
-c quality quality from big images 0-100% (default: $ARG_BIGQALITY) |
Line 50 Options:
|
Line 51 Options:
|
(default: $ARG_FILETYPES) |
(default: $ARG_FILETYPES) |
-t size size from thumbnail images in pixel (default: $ARG_TNSIZE) |
-t size size from thumbnail images in pixel (default: $ARG_TNSIZE) |
-u quality quality from thumbnail images 0-100% (default: $ARG_BIGQALITY) |
-u quality quality from thumbnail images 0-100% (default: $ARG_BIGQALITY) |
|
-v print version |
|
-C copyright copyright (html) string (default: $ARG_COPYRIGHT) |
|
-I file info text file for pgallery. info file paras prefered. |
|
the syntax of the file is MAKE(1) |
|
supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE |
|
TNQALITY BIGSIZE BIGQALITY |
-U no update, new calculation of all images. |
-U no update, new calculation of all images. |
normally only new and modified images will calculated |
normally only new and modified images will calculated |
-C copyright copyright (html) string (default: $ARG_COPYRIGHT) |
|
-v print version |
|
USAGE |
USAGE |
exit |
exit |
} |
} |
Line 140 HLaErzv/wD99ABmjNZk0AAAAABJRU5ErkJggg==");
|
Line 145 HLaErzv/wD99ABmjNZk0AAAAABJRU5ErkJggg==");
|
margin: 10px auto; |
margin: 10px auto; |
font-family: Geneva,Arial,sans-serif; |
font-family: Geneva,Arial,sans-serif; |
font-size: 12px; |
font-size: 12px; |
|
text-shadow: 1px 1px 1px #000; |
} |
} |
div.tn { |
div.tn { |
float: left; |
float: left; |
Line 161 div.tn, div.big {
|
Line 167 div.tn, div.big {
|
border-color: gray; |
border-color: gray; |
box-shadow: 1px 1px 2px #000; |
box-shadow: 1px 1px 2px #000; |
padding: 1px; |
padding: 1px; |
|
border-radius: 3px; |
} |
} |
div.tn:hover { |
div.tn:hover { |
background-color: #222; |
background-color: #222; |
Line 177 div.over {
|
Line 184 div.over {
|
} |
} |
div.over a.left, div.over a.right { |
div.over a.left, div.over a.right { |
display: block; |
display: block; |
|
/* shell fuck of: missing CTLARI (shouldn't happen) - WTF?! */ |
|
width: $(($ARG_BIGSIZE / 2))px; |
position: relative; |
position: relative; |
top: 1px; |
top: 1px; |
left: 1px; |
left: 1px; |
background-repeat: no-repeat; |
background-repeat: no-repeat; |
width: $(($ARG_BIGSIZE / 2))px; |
|
} |
} |
div.over a.left:hover { |
div.over a.left:hover { |
background-position: 5% center; |
background-position: 5% center; |
Line 231 div.box div.c {
|
Line 239 div.box div.c {
|
line-height: 25px; |
line-height: 25px; |
position: relative; |
position: relative; |
left: 4px; |
left: 4px; |
text-shadow: 1px 1px 1px #000; |
|
} |
} |
body > div.c { |
body > div.c { |
text-align: center; |
text-align: center; |
Line 240 body > div.c {
|
Line 247 body > div.c {
|
height: 25px; |
height: 25px; |
line-height: 25px; |
line-height: 25px; |
position: relative; |
position: relative; |
text-shadow: 1px 1px 1px #000; |
|
margin: 4px; |
margin: 4px; |
} |
} |
a img { |
a img { |
Line 262 div.nav a:hover {
|
Line 268 div.nav a:hover {
|
div.nav div.top { |
div.nav div.top { |
position: absolute; |
position: absolute; |
text-align: center; |
text-align: center; |
width: ${ARG_BIGSIZE}px; | width: $(($ARG_BIGSIZE - 100))px; |
| margin: 0 50px; |
} |
} |
.left { |
.left { |
float: left; |
float: left; |
Line 322 html_img()
|
Line 329 html_img()
|
linkb=$3 |
linkb=$3 |
linkn=$4 |
linkn=$4 |
|
|
height=$($BIN_IMGINFO -f $img | awk '{print $4}') | info=$($BIN_IMGINFO -f $img) |
| width=$(echo $info | awk '{print $3}') |
| height=$(echo $info | awk '{print $4}') |
|
|
if [ "$linkb" != "" ] |
if [ "$linkb" != "" ] |
then |
then |
Line 339 html_img()
|
Line 348 html_img()
|
cat <<HTML |
cat <<HTML |
<div class="box"> |
<div class="box"> |
<div class="nav"> |
<div class="nav"> |
<div class="left">$hlinkb</div> |
|
<div class="top"><a href="$link">Index</a></div> |
<div class="top"><a href="$link">Index</a></div> |
|
<div class="left">$hlinkb</div> |
<div class="right">$hlinkn</div> |
<div class="right">$hlinkn</div> |
</div> |
</div> |
<div class="big"> |
<div class="big"> |
<img src="$img" /> | <img alt="$img" width="$width" height="$height" src="$img" /> |
</div> |
</div> |
<div class="c"> |
<div class="c"> |
$ARG_TITLE $ARG_COPYRIGHT |
$ARG_TITLE $ARG_COPYRIGHT |
Line 412 do
|
Line 421 do
|
ARG_COPYRIGHT=$1 |
ARG_COPYRIGHT=$1 |
shift |
shift |
;; |
;; |
|
-I) |
|
ARG_INFOFILE=$1 |
|
shift |
|
;; |
-U) |
-U) |
ARG_UPDATE=0 |
ARG_UPDATE=0 |
;; |
;; |
Line 425 do
|
Line 438 do
|
esac |
esac |
done |
done |
|
|
|
# parese info file |
|
if [ "$ARG_INFOFILE" != "" ] |
|
then |
|
test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''" |
|
for n in TITLE COPYRIGHT INDEX FILETYPES TNSIZE TNQALITY BIGSIZE BIGQALITY |
|
do |
|
v=$(make -f $ARG_INFOFILE -V$n) |
|
test "$v" = "" && continue |
|
eval "ARG_$n='$v'" |
|
done |
|
fi |
|
|
|
echo $ARG_COPYRIGHT |
|
exit |
|
|
MY=$(get_my_path) |
MY=$(get_my_path) |
cd "$ARG_DIR" || exit 1 |
cd "$ARG_DIR" || exit 1 |
|
|
Line 453 echo
|
Line 481 echo
|
|
|
test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''" |
test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''" |
|
|
|
# find new and to update images |
|
FLIST_NEW= |
|
FLIST_UPDATE= |
|
echo "all: tns" > $MKAKEFILE |
|
targets="" |
|
for file in $FLIST |
|
do |
|
tn="${file}.tn.jpg" |
|
if [ ! -f $tn ] |
|
then |
|
FLIST_NEW="$FLIST_NEW $file" |
|
continue |
|
fi |
|
|
|
targets="$targets $tn" |
|
( |
|
cat <<MAKE |
|
$tn: $file |
|
@echo ${file} |
|
MAKE |
|
) >> $MKAKEFILE |
|
done |
|
echo "tns: $targets" >> $MKAKEFILE |
|
FLIST_UPDATE=$(make -f $MKAKEFILE) |
|
rm $MKAKEFILE |
|
|
|
# update and no new and update images found |
|
if [ $ARG_UPDATE -eq 1 -a "$FLIST_NEW" = "" -a "$FLIST_UPDATE" = "" ] |
|
then |
|
echo nothing to do |
|
exit 1 |
|
fi |
|
|
|
if [ $ARG_UPDATE -eq 1 ] |
|
then |
|
echo new images: $FLIST_NEW |
|
echo update images: $FLIST_UPDATE |
|
fi |
|
exit |
|
|
# Create make file to rotate und convert all big and thumbnails. |
# Create make file to rotate und convert all big and thumbnails. |
# Is needed to define the new real image sizes. |
# Is needed to define the new real image sizes. |
echo "all: tns" > $MKAKEFILE |
echo "all: tns" > $MKAKEFILE |
Line 472 do
|
Line 540 do
|
fi |
fi |
|
|
( |
( |
cat <<MAKE | cat <<MAKE |
$target |
$target |
$BIN_EXIFAUTOTRAN $file |
$BIN_EXIFAUTOTRAN $file |
$BIN_CONVERT -verbose -thumbnail ${ARG_TNSIZE}x${ARG_TNSIZE} -quality $ARG_TNQALITY $file $tn |
$BIN_CONVERT -verbose -thumbnail ${ARG_TNSIZE}x${ARG_TNSIZE} -quality $ARG_TNQALITY $file $tn |