Annotation of scripts/pgallery/src/pgallery.sh, revision 1.2
1.1 as 1: #!/bin/sh
2: #
3: # THE BEER-WARE LICENSE 2012
4: # <as@paefchen.net> wrote this file. As long as you retain this notice you
5: # can do whatever you want with this stuff. If we meet some day, and you think
6: # this stuff is worth it, you can buy me a beer in return Aron Schlesinger
7: #
1.2 ! as 8: # $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.1 2012/08/27 14:23:59 as Exp $
1.1 as 9: #
10:
11: ARG_TITLE="PGallery"
12: ARG_FILES=
13: ARG_FILETYPES="jpg jpeg png gif tif tiff"
14: ARG_TNSIZE="180"
15: ARG_TNQALITY="70"
16: ARG_BIGSIZE="950"
17: ARG_BIGQALITY="90"
18: ARG_INDEX="index.html"
19: ARG_DIR="."
20: ARG_UPDATE=1
21: ARG_COPYRIGHT="© $(date +%Y)"
22:
23: BIN_CONVERT="/usr/local/bin/convert"
24: BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran"
25: BIN_IMGINFO="/usr/local/bin/imginfo"
26:
27: MKAKEFILE=".htmakefile"
28: VERSION="pgallery-1"
29:
30: #
31: # usage()
32: #
33: usage()
34: {
35: cat <<USAGE
36: usage $0: ( [-f <files>] | [-s <suffix>] ) [-d <dir>] [-n <name>]
37: [-t <thumbnail_size>] [-u <thumbnail_quality>]
38: [-b <big_size>] [-c <big_quality>]
39: [-i <index>] [-U] | -h
40: Options:
41: -b size size from big images in pixel (default: $ARG_BIGSIZE)
42: -c quality quality from big images 0-100% (default: $ARG_BIGQALITY)
43: -d dir gallery dir (default: $ARG_DIR)
44: -f files gallery images
45: -h this page
46: -i name index file name (default: $ARG_INDEX)
47: -n name page title (default: $ARG_TITLE)
48: -s suffix list of suffix. if no \`\`-f'' defined, used to find images
49: in \`\`-d'' directoy. case insensitive
50: (default: $ARG_FILETYPES)
51: -t size size from thumbnail images in pixel (default: $ARG_TNSIZE)
52: -u quality quality from thumbnail images 0-100% (default: $ARG_BIGQALITY)
53: -U no update, new calculation of all images.
54: normally only new and modified images will calculated
55: -C copyright copyright (html) string (default: $ARG_COPYRIGHT)
56: -v print version
57: USAGE
58: exit
59: }
60:
61: #
62: # get_my_path()
63: #
64: get_my_path()
65: {
66: current=$(pwd)
67: cd $(dirname $0)
68: echo $(pwd)/$(basename $0)
69: cd "$current"
70: }
71:
72: #
73: # html_header()
74: #
75: html_header()
76: {
77: cat <<HTML
78: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
79: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
80: <html xmlns="http://www.w3.org/1999/xhtml">
81: <head>
82: <title>$ARG_TITLE</title>
83: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
84: <style type="text/css">
85: <!--
86: body {
87: background-color: #464646;
88: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYB\
89: AMAAACDuy0HAAAAG1BMVEX+/v4BAQH///8KCgoDAwN/f3/19fWAgID8/PzhDwT2AAAACXRSTlMFBQUFBQU\
90: FBQWHDtP9AAALwklEQVR4Xg3KOWOyWhAA0Bn2ci57eXEvQY1JCZp8sQTjVoJLTAkaE0swbj/7ve4UB37FL\
91: W4q86Lwwlh86J/ASAkpWaj+Krbb31HzH0Kjc2tIl7SADaWbpZBPE5dds6jJNyNdjAyKWqdroIixWRQIY6E\
92: /kOY7hIciL/ZfrAO3XP/06AuUJ3mSd/z95OB9vIal0DPlaZWHP7RE6DIXjmKqKkuGr+xNZylOnj1GSlUKv\
93: nxZDBOIzTfMe0fJgJ7c/GIIOdUuKxYyBFUOzvY6AC5AXx8R+o5O4S0j0wqBND3ErIYm/XHFbQjtH1MXD5d\
94: Ubp19OFdjkDlys+HSwrBgHRvL9wVN/pi8ViOIwcv/D1GRW6UuDvJLLQA5lCI17iUdsKYpOuYfMATGnpn/Z\
95: s3W6gov51G+/Vs9Ay//we5kh8uwvEPum6o5HkDMDb3ZWunwtq+UzENU8NphDdbvNtKM3knx5gi6UM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uCcOhZqfekuQxjQ7EoyGUJAwCv/q1JOuJeCc/3lknb76zAquO/DAQhK/6\
134: 2cP8X2s3+IBLIhvL8RHopoHpIArJysYTTmMMeubPXh8W760AvMVH67jqgg06+/ne5MZ631z6yROhloh3dP\
135: QirZoEpr80wgt/cEbhbAQTmRLtGh8lxCwDBBb5OeJ4aEq25XBNMT2rzWedW2zIzj+CCDKlnlyJBzT81qBW\
136: p69h7vlb3TmEV+DNm2rqj1iT7BQuwVVsuPkwq1e5P8tgNjVbIlMzwXeM11kZqjx3KKFOJzc3CAyFVhi8fx\
137: VZ5FvhdAM5mM6kS6OgKu16MFglq3/b/QVIwdw7HUCyeW04JPjC5dO+GC9OfqfB4VX+wwuift+ths2Ss3i6\
138: nkOE+JFyD+wKFL+WMX6nwwDva0S1/O8Mlnida69Ph96fuFvCoRMvXnCfsLPPmC/hA5RnMNE4fDK0pVOQ4B\
139: HLaErzv/wD99ABmjNZk0AAAAABJRU5ErkJggg==");
140: margin: 10px auto;
141: font-family: Geneva,Arial,sans-serif;
142: font-size: 12px;
1.2 ! as 143: text-shadow: 1px 1px 1px #000;
1.1 as 144: }
145: div.tn {
146: float: left;
147: width: ${ARG_TNSIZE}px;
148: height: ${ARG_TNSIZE}px;
149: vertical-align:text-top;
150: text-align: center;
151: margin: 4px;
152: }
153: div.tn a {
154: position: relative;
155: display: inline-block;
156: height: ${ARG_TNSIZE}px;
157: }
158: div.tn, div.big {
159: background-color: black;
160: border-width: 1px;
161: border-style: solid;
162: border-color: gray;
163: box-shadow: 1px 1px 2px #000;
164: padding: 1px;
165: }
166: div.tn:hover {
167: background-color: #222;
168: }
169: div.big {
170: display: inline-block;
171: width: ${ARG_BIGSIZE}px;
172: }
173: div.over {
174: width: ${ARG_BIGSIZE}px;
175: position: absolute;
176: top: 30px;
177: padding: 1px;
178: }
179: div.over a.left, div.over a.right {
180: display: block;
1.2 ! as 181: /* shell fuck of: missing CTLARI (shouldn't happen) - WTF?! */
! 182: width: $(($ARG_BIGSIZE / 2))px;
1.1 as 183: position: relative;
184: top: 1px;
185: left: 1px;
186: background-repeat: no-repeat;
187: }
188: div.over a.left:hover {
189: background-position: 5% center;
190: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
191: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAh9JREFUeNrE2L1Lw0A\
192: UAHATSivSZii0ldpBnMU6SgYJpQUJDlk7dLV+LTqIiIv4B7kLolBKQRA6GLqUDMEhqKAlhUIR4125SHo0b\
193: XJ51x68pDSX+3G5I/dyguM4S/MuMfeHIAiQ7Yo+//+OocAYPm+jWEXxg8JC8erCgvt4AXrqgkkUJRRZ6jq\
194: G71EMRcAeil6wWq2uGYZx1ul0jjRNy5Jey6PauKcRJ5NIhklCoaE4QODNYDCwHVJ6vd5HIpE4xNdQxKOiM\
195: 0G3FIvFc4Imo6CBQV3XXwioje5jREOBkiQdE3SLFWUFFXJfaJQVLP2DIWdvFDA+9pYKiMKBAVFYMAAKD85\
196: A+YBTUH6gD8oXnIDyB31QviCFzgekUPxYVe4ghW7ixhRFueQKUmgZN9hut1s0aNv2V6FQOAUBqRvT+IAaX\
197: 6crWZb1hsqQJFfPkPnpJz6YpmnQlXK5XD6TycRIcrUDib7jQ71ev+v3+9/eSqlUKt1qtU4IvIFid2x9jDC\
198: muJE9PG6qql7jcaTHttvt6gh2J1MZYva6ees+d9jnjcQXnoDyh31WGb7wlPWUHzwjc+ADB8iR4OGA2SAsH\
199: CLvhYNDZvgwMMO3THSY8auNBS6xfrVFhZUoaGjYk+qA7DkEgmu12i1Bs1C7K1NhvLviecTLEOhEuFKpXDW\
200: bzcdGo/Egy/KFZzKJPHbMVsiEyVPXTRRPeMdMWMQuqLi0gPInwACOBcZx3lRFMwAAAABJRU5ErkJggg==");
201: }
202: div.over a.right:hover {
203: background-position: 95% center;
204: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
205: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAiJJREFUeNrE2D1Lw0A\
206: YAOAmlNbBdii0FVM6OEu7SgcJpRUJDlk7dE21uuggIi7iD/IX+AGlFAXBDqVLyVCCBBW0JFhwMN7JHRxnY\
207: 5PcnX3hhSM58nB3+Xhzkud5sf8OiWjLPn2+eGF4gHEChLkOcgUdt0E+isAlhCVAbiGQjGeQ1yBdHjAeKZ7\
208: SCgR1Xc8Nh8M90zQPG42GAo7lQFZBLhOzwSXgKI1kMrk7mUxePBTT6dQB8Dk8B1IHmUbTLrOMFI8WjsIol\
209: 8tHHhW8YRKV0QWNwWDwIBKm0RK8aDqdbouEaRReQBUNkygJV0XCNBojnldh8CxUOOyHCoX/QoXB81AhcBC\
210: UOxwU5QqHQbnBYVFWODLKDEdFo8IanGYWNBSsquoJgkus6C+4UCgcOI7zRsP9fv8OoTWM8qh57mHlaFnWp\
211: 23bFn1SUZQiambm1bphYgMWddlsNp7P51fpk+Px2ETNV1YUf383Qa5BsNfr7adSqQzZyXXd91ardUmUs8x\
212: rWYNrBcD2aDQa0GsJ11fTtDO0ntssd28UcAfXzSxvpLBg5DcSKyhH/cowgVG+p8xg2MqBCximRuIGBq0Gu\
213: YJB6l7u4LwKXwjo9y8jFPT7a6uKBGehqmiQRhO45BAJ0ijcQTGazeaFSJBGl/DUkrsrvMFZa/pzE1UqleN\
214: Op3PV7XZv6vX6KU+QRMkdM3gzFal+TyBvQX7w3DGTFrELKscWEN8CDADBm8pgcciwqgAAAABJRU5ErkJgg\
215: g==");
216: }
217: div.big a {
218: position: relative;
219: display: inline-block;
220: width: ${ARG_BIGSIZE}px;
221: }
222: div.box {
223: text-align: center;
224: width: ${ARG_BIGSIZE}px;
225: margin: auto;
226: }
227: div.box div.c {
228: width: ${ARG_BIGSIZE}px;
229: text-align: right;
230: font-size: 90%;
231: color: #808080;
232: height: 25px;
233: line-height: 25px;
234: position: relative;
235: left: 4px;
236: }
237: body > div.c {
238: text-align: center;
239: font-size: 90%;
240: color: #808080;
241: height: 25px;
242: line-height: 25px;
243: position: relative;
244: margin: 4px;
245: }
246: a img {
247: border-width: 0;
248: }
249: a {
250: }
251: div.nav {
252: width: ${ARG_BIGSIZE}px;
253: height: 20px;
254: }
255: div.nav a {
256: color: #FFF;
257: text-decoration: none;
258: }
259: div.nav a:hover {
260: text-decoration: underline;
261: }
262: div.nav div.top {
263: position: absolute;
264: text-align: center;
1.2 ! as 265: width: $(($ARG_BIGSIZE - 100))px;
! 266: margin: 0 50px;
1.1 as 267: }
268: .left {
269: float: left;
270: }
271: .right {
272: float: right;
273: }
274: .clear {
275: clear: both;
276: }
277: -->
278: </style>
279: </head>
280: <body>
281: HTML
282: }
283:
284: #
285: # html_footer()
286: #
287: html_footer()
288: {
289: cat <<HTML
290: </body></html>
291: HTML
292: }
293:
294: #
295: # html_tn()
296: #
297: html_tn()
298: {
299: tn=$1
300: link=$2
301:
302: info=$($BIN_IMGINFO -f $tn)
303: width=$(echo $info | awk '{print $3}')
304: height=$(echo $info | awk '{print $4}')
305: top=$(($(($ARG_TNSIZE - $height)) / 2))
306:
307: cat <<HTML
308: <div class="tn">
309: <a href="$link" style="top:${top}px">
310: <img alt="$tn" width="$width" height="$height" src="$tn" />
311: </a>
312: </div>
313: HTML
314: }
315:
316: #
317: # html_img()
318: #
319: html_img()
320: {
321: img=$1
322: link=$2
323: linkb=$3
324: linkn=$4
325:
326: height=$($BIN_IMGINFO -f $img | awk '{print $4}')
327:
328: if [ "$linkb" != "" ]
329: then
330: hlinkb="<a href='$linkb'>zurück</a>"
331: olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>"
332: fi
333:
334: if [ "$linkn" != "" ]
335: then
336: hlinkn="<a href="$linkn">weiter</a>"
337: olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>"
338: fi
339:
340: cat <<HTML
341: <div class="box">
342: <div class="nav">
1.2 ! as 343: <div class="top"><a href="$link">Index</a></div>
1.1 as 344: <div class="left">$hlinkb</div>
345: <div class="right">$hlinkn</div>
346: </div>
347: <div class="big">
348: <img src="$img" />
349: </div>
350: <div class="c">
351: $ARG_TITLE $ARG_COPYRIGHT
352: </div>
353: <div class="over" style='height:${height}px'>
354: $olinkb
355: $olinkn
356: </div>
357: </div>
358: HTML
359: }
360:
361: #
362: # err
363: #
364: err()
365: {
366: echo "$1" >&2
367: exit 1
368: }
369:
370:
371: # parse args
372: while [ "$1" != "" ]
373: do
374: arg=$1
375: shift
376: case $arg in
377: -h)
378: usage
379: ;;
380: -n)
381: ARG_TITLE=$1
382: shift
383: ;;
384: -t)
385: ARG_TNSIZE=$1
386: shift
387: ;;
388: -u)
389: ARG_TNQALITY=$1
390: shift
391: ;;
392: -b)
393: ARG_BIGSIZE=$1
394: shift
395: ;;
396: -c)
397: ARG_BIGQALITY=$1
398: shift
399: ;;
400: -f)
401: ARG_FILES=$1
402: shift
403: ;;
404: -s)
405: ARG_FILETYPES=$1
406: shift
407: ;;
408: -d)
409: ARG_DIR=$1
410: shift
411: ;;
412: -C)
413: ARG_COPYRIGHT=$1
414: shift
415: ;;
416: -U)
417: ARG_UPDATE=0
418: ;;
419: -v)
420: echo $VERSION
421: exit
422: ;;
423: *)
424: echo "unknown argument $arg"
425: exit
426: esac
427: done
428:
429: MY=$(get_my_path)
430: cd "$ARG_DIR" || exit 1
431:
432: # if no images defined, find files
433: if [ "$ARG_FILES" = "" -a "$ARG_FILETYPES" != "" ]
434: then
435: match=
436: for type in $ARG_FILETYPES
437: do
438: match="$match *.$(echo $type | tr '[:lower:]' '[:upper:]')"
439: match="$match *.$(echo $type | tr '[:upper:]' '[:lower:]')"
440: done
441: ARG_FILES=$(cd $ARG_DIR && ls $match 2>/dev/null)
442: fi
443:
444: # Filter big and thumbnails
445: echo -n "find images"
446: FLIST=
447: for file in $ARG_FILES
448: do
449: test $(echo $file | grep -E '\.(tn|big)\.jpg$') && continue
450: FLIST="$FLIST $file"
451: echo -n " $file"
452: done
453: echo
454:
455: test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''"
456:
457: # Create make file to rotate und convert all big and thumbnails.
458: # Is needed to define the new real image sizes.
459: echo "all: tns" > $MKAKEFILE
460: targets=""
461: for file in $FLIST
462: do
463: tn="${file}.tn.jpg"
464: big="${file}.big.jpg"
465: targets="$targets $tn"
466:
467: target=
468: if [ $ARG_UPDATE -eq 1 ]
469: then
470: target="$tn: $ME $file"
471: else
472: target="$tn::"
473: fi
474:
475: (
476: cat <<MAKE
477: $target
478: $BIN_EXIFAUTOTRAN $file
479: $BIN_CONVERT -verbose -thumbnail ${ARG_TNSIZE}x${ARG_TNSIZE} -quality $ARG_TNQALITY $file $tn
480: $BIN_CONVERT -verbose -thumbnail ${ARG_BIGSIZE}x${ARG_BIGSIZE} -quality $ARG_BIGQALITY $file $big
481: MAKE
482: ) >> $MKAKEFILE
483: done
484: echo "tns: $targets" >> $MKAKEFILE
485:
486: make -f $MKAKEFILE
487: rm $MKAKEFILE
488:
489: # create single html files
490: index=""
491: i=0
492: echo -n "create single html files "
493: for file in $FLIST
494: do
495: h=$i
496: i=$(($i + 1))
497: j=$(($i + 1))
498:
499: tn="${file}.tn.jpg"
500: big="${file}.big.jpg"
501: imglink="${file}.html"
502:
503: if [ $i -ne 1 ]
504: then
505: linkb=$(echo $FLIST | awk "{print \$$h}").html
506: fi
507: linkn=$(echo $FLIST | awk "{print \$$j}")
508: test "$linkn" != "" && linkn="$linkn.html"
509:
510: echo -n .
511: index="$index $(html_tn $tn $imglink)"
512: (
513: html_header
514: html_img $big $ARG_INDEX "$linkb" "$linkn"
515: html_footer
516: ) > $imglink
517: done
518: echo
519:
520: # create html index
521: echo create html index
522: (
523: html_header
524: echo $index
525: echo "<div class='clear'></div>"
526: echo "<div class='c'>$ARG_TITLE $ARG_COPYRIGHT</div>"
527: html_footer
528: ) > $ARG_INDEX