version 1.11, 2012/08/29 11:21:41
|
version 1.14, 2012/08/29 13:36:01
|
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: scripts/pgallery/src/pgallery.sh,v 1.10 2012/08/29 10:52:35 as Exp $ | # $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.13 2012/08/29 12:41:06 as Exp $ |
# |
# |
|
|
ARG_TITLE="PGallery" |
ARG_TITLE="PGallery" |
Line 256 div.box div.i {
|
Line 256 div.box div.i {
|
height: 25px; |
height: 25px; |
line-height: 25px; |
line-height: 25px; |
position: relative; |
position: relative; |
left: 4px; |
|
} |
} |
body > div.c { |
body > div.c { |
text-align: center; |
text-align: center; |
Line 342 HTML
|
Line 341 HTML
|
html_img() |
html_img() |
{ |
{ |
orig=$1 |
orig=$1 |
img=$2 | num=$2 |
link=$3 | all=$3 |
linkb=$4 | img=$4 |
linkn=$5 | link=$5 |
| linkb=$6 |
| linkn=$7 |
|
|
info=$($BIN_IMGINFO -f $img) |
info=$($BIN_IMGINFO -f $img) |
width=$(echo $info | awk '{print $3}') |
width=$(echo $info | awk '{print $3}') |
Line 359 html_img()
|
Line 360 html_img()
|
|
|
if [ "$linkb" != "" ] |
if [ "$linkb" != "" ] |
then |
then |
hlinkb="<a href='$linkb'>zurück</a>" | hlinkb="<a href='$linkb'>prev</a>" |
olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>" |
olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>" |
fi |
fi |
|
|
if [ "$linkn" != "" ] |
if [ "$linkn" != "" ] |
then |
then |
hlinkn="<a href="$linkn">weiter</a>" | hlinkn="<a href="$linkn">next</a>" |
olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>" |
olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>" |
fi |
fi |
|
|
cat <<HTML |
cat <<HTML |
<div class="box"> |
<div class="box"> |
<div class="nav"> |
<div class="nav"> |
<div class="top"><a href="$link">Index</a></div> | <div class="top"> |
| <a href="$link">index</a> | <a href="$orig">original</a> | $num/$all |
| </div> |
<div class="left">$hlinkb</div> |
<div class="left">$hlinkb</div> |
<div class="right">$hlinkn</div> |
<div class="right">$hlinkn</div> |
</div> |
</div> |
Line 433 get_exif_desc()
|
Line 436 get_exif_desc()
|
} |
} |
|
|
# |
# |
|
# get_exif_ts() |
|
# |
|
get_exif_ts() |
|
{ |
|
img=$1 |
|
date=$($BIN_EXIF --ifd=EXIF --tag=0x9003 -m $img 2> /dev/null) |
|
if [ "$date" = "" ] |
|
then |
|
echo "-1" |
|
return 1 |
|
fi |
|
date -j -f "%Y:%m:%d %T" "$date" "+%s" |
|
} |
|
|
|
# |
|
# get_exif_date() |
|
# |
|
get_exif_date() |
|
{ |
|
img=$1 |
|
ts=$(get_exif_ts $img) && date -r $ts "+%d.%m.%Y %H:%M" || echo "" |
|
} |
|
|
|
# |
# get_exif_value() |
# get_exif_value() |
# |
# |
get_exif_value() |
get_exif_value() |
Line 448 get_exif_value()
|
Line 475 get_exif_value()
|
get_exif_info() |
get_exif_info() |
{ |
{ |
img=$1 |
img=$1 |
|
|
exifinfo= |
exifinfo= |
|
created=$(get_exif_date $img) && exifinfo="$created / " |
|
|
for exif in $ARG_EXIF |
for exif in $ARG_EXIF |
do |
do |
if echo $exif | grep -q -E '0x[[:alnum:]]{4}' |
if echo $exif | grep -q -E '0x[[:alnum:]]{4}' |
Line 458 get_exif_info()
|
Line 488 get_exif_info()
|
exifinfo="$exifinfo$exif " |
exifinfo="$exifinfo$exif " |
fi |
fi |
done |
done |
echo $exifinfo | sed -e 's/ mm /mm /' -e 's/ sec./s/' -e 's/ ISO / ISO/' | echo $exifinfo | sed -E -e 's/ mm /mm /' -e 's/ sec./s/' -e 's/ ISO / ISO/' -e 's/ ISO(\/| )/ \1/' |
} |
} |
|
|
# |
# |
Line 536 do
|
Line 566 do
|
esac |
esac |
done |
done |
|
|
|
# go to gallery directory |
|
MY=$(get_my_path) |
|
cd "$ARG_DIR" || exit 1 |
|
|
# parese info file |
# parese info file |
if [ "$ARG_INFOFILE" != "" ] |
if [ "$ARG_INFOFILE" != "" ] |
then |
then |
Line 549 then
|
Line 583 then
|
done |
done |
fi |
fi |
|
|
# go to gallery directory |
|
MY=$(get_my_path) |
|
cd "$ARG_DIR" || exit 1 |
|
|
|
# fix url |
# fix url |
if [ "$ARG_URL" != "" ] |
if [ "$ARG_URL" != "" ] |
then |
then |
Line 584 echo
|
Line 614 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''" |
|
|
|
# use exif createtime to order images |
|
FLIST=$( |
|
( |
|
for file in $FLIST |
|
do |
|
echo "$(get_exif_ts $file) $file" |
|
done |
|
) | sort -n | awk '{print $2}' |
|
) |
|
|
# find new and to update images |
# find new and to update images |
FLIST_NEW= |
FLIST_NEW= |
FLIST_UPDATE= |
FLIST_UPDATE= |
Line 675 echo create html index
|
Line 715 echo create html index
|
# create single html files |
# create single html files |
#test $ARG_UPDATE -eq 1 && FLIST="$FLIST_NEW $FLIST_UPDATE" |
#test $ARG_UPDATE -eq 1 && FLIST="$FLIST_NEW $FLIST_UPDATE" |
i=0 |
i=0 |
|
all=$(echo $FLIST | wc -w) |
echo -n "create single html files " |
echo -n "create single html files " |
for file in $FLIST |
for file in $FLIST |
do |
do |
Line 701 do
|
Line 742 do
|
echo -n . |
echo -n . |
( |
( |
html_header |
html_header |
html_img $file $big $ARG_INDEX "$linkb" "$linkn" | html_img $file $i $all $big $ARG_INDEX "$linkb" "$linkn" |
html_footer |
html_footer |
) > $imglink |
) > $imglink |
done |
done |