Annotation of scripts/pgallery/src/pgallery.sh, revision 1.4
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.4 ! as 8: # $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.3 2012/08/28 08:27:25 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>]
1.4 ! as 39: [-i <index>] [-C <copyright>] [-U] | -h | -v
1.1 as 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)
1.4 ! as 53: -v print version
! 54: -C copyright copyright (html) string (default: $ARG_COPYRIGHT)
1.1 as 55: -U no update, new calculation of all images.
56: normally only new and modified images will calculated
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//we5kh8uwvEPum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dzL9BNARxTSr7T3\
133: u1rE+IWUmCIpwTZHZCu5l9THCuCcOhZqfekuQxjQ7EoyGUJAwCv/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;
1.4 ! as 165: border-radius: 3px;
1.1 as 166: }
167: div.tn:hover {
168: background-color: #222;
169: }
170: div.big {
171: display: inline-block;
172: width: ${ARG_BIGSIZE}px;
173: }
174: div.over {
175: width: ${ARG_BIGSIZE}px;
176: position: absolute;
177: top: 30px;
178: padding: 1px;
179: }
180: div.over a.left, div.over a.right {
181: display: block;
1.2 as 182: /* shell fuck of: missing CTLARI (shouldn't happen) - WTF?! */
183: width: $(($ARG_BIGSIZE / 2))px;
1.1 as 184: position: relative;
185: top: 1px;
186: left: 1px;
187: background-repeat: no-repeat;
188: }
189: div.over a.left:hover {
190: background-position: 5% center;
191: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
192: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAh9JREFUeNrE2L1Lw0A\
193: UAHATSivSZii0ldpBnMU6SgYJpQUJDlk7dLV+LTqIiIv4B7kLolBKQRA6GLqUDMEhqKAlhUIR4125SHo0b\
194: XJ51x68pDSX+3G5I/dyguM4S/MuMfeHIAiQ7Yo+//+OocAYPm+jWEXxg8JC8erCgvt4AXrqgkkUJRRZ6jq\
195: G71EMRcAeil6wWq2uGYZx1ul0jjRNy5Jey6PauKcRJ5NIhklCoaE4QODNYDCwHVJ6vd5HIpE4xNdQxKOiM\
196: 0G3FIvFc4Imo6CBQV3XXwioje5jREOBkiQdE3SLFWUFFXJfaJQVLP2DIWdvFDA+9pYKiMKBAVFYMAAKD85\
197: A+YBTUH6gD8oXnIDyB31QviCFzgekUPxYVe4ghW7ixhRFueQKUmgZN9hut1s0aNv2V6FQOAUBqRvT+IAaX\
198: 6crWZb1hsqQJFfPkPnpJz6YpmnQlXK5XD6TycRIcrUDib7jQ71ev+v3+9/eSqlUKt1qtU4IvIFid2x9jDC\
199: muJE9PG6qql7jcaTHttvt6gh2J1MZYva6ees+d9jnjcQXnoDyh31WGb7wlPWUHzwjc+ADB8iR4OGA2SAsH\
200: CLvhYNDZvgwMMO3THSY8auNBS6xfrVFhZUoaGjYk+qA7DkEgmu12i1Bs1C7K1NhvLviecTLEOhEuFKpXDW\
201: bzcdGo/Egy/KFZzKJPHbMVsiEyVPXTRRPeMdMWMQuqLi0gPInwACOBcZx3lRFMwAAAABJRU5ErkJggg==");
202: }
203: div.over a.right:hover {
204: background-position: 95% center;
205: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
206: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAiJJREFUeNrE2D1Lw0A\
207: YAOAmlNbBdii0FVM6OEu7SgcJpRUJDlk7dE21uuggIi7iD/IX+AGlFAXBDqVLyVCCBBW0JFhwMN7JHRxnY\
208: 5PcnX3hhSM58nB3+Xhzkud5sf8OiWjLPn2+eGF4gHEChLkOcgUdt0E+isAlhCVAbiGQjGeQ1yBdHjAeKZ7\
209: SCgR1Xc8Nh8M90zQPG42GAo7lQFZBLhOzwSXgKI1kMrk7mUxePBTT6dQB8Dk8B1IHmUbTLrOMFI8WjsIol\
210: 8tHHhW8YRKV0QWNwWDwIBKm0RK8aDqdbouEaRReQBUNkygJV0XCNBojnldh8CxUOOyHCoX/QoXB81AhcBC\
211: UOxwU5QqHQbnBYVFWODLKDEdFo8IanGYWNBSsquoJgkus6C+4UCgcOI7zRsP9fv8OoTWM8qh57mHlaFnWp\
212: 23bFn1SUZQiambm1bphYgMWddlsNp7P51fpk+Px2ETNV1YUf383Qa5BsNfr7adSqQzZyXXd91ardUmUs8x\
213: rWYNrBcD2aDQa0GsJ11fTtDO0ntssd28UcAfXzSxvpLBg5DcSKyhH/cowgVG+p8xg2MqBCximRuIGBq0Gu\
214: YJB6l7u4LwKXwjo9y8jFPT7a6uKBGehqmiQRhO45BAJ0ijcQTGazeaFSJBGl/DUkrsrvMFZa/pzE1UqleN\
215: Op3PV7XZv6vX6KU+QRMkdM3gzFal+TyBvQX7w3DGTFrELKscWEN8CDADBm8pgcciwqgAAAABJRU5ErkJgg\
216: g==");
217: }
218: div.big a {
219: position: relative;
220: display: inline-block;
221: width: ${ARG_BIGSIZE}px;
222: }
223: div.box {
224: text-align: center;
225: width: ${ARG_BIGSIZE}px;
226: margin: auto;
227: }
228: div.box div.c {
229: width: ${ARG_BIGSIZE}px;
230: text-align: right;
231: font-size: 90%;
232: color: #808080;
233: height: 25px;
234: line-height: 25px;
235: position: relative;
236: left: 4px;
237: }
238: body > div.c {
239: text-align: center;
240: font-size: 90%;
241: color: #808080;
242: height: 25px;
243: line-height: 25px;
244: position: relative;
245: margin: 4px;
246: }
247: a img {
248: border-width: 0;
249: }
250: a {
251: }
252: div.nav {
253: width: ${ARG_BIGSIZE}px;
254: height: 20px;
255: }
256: div.nav a {
257: color: #FFF;
258: text-decoration: none;
259: }
260: div.nav a:hover {
261: text-decoration: underline;
262: }
263: div.nav div.top {
264: position: absolute;
265: text-align: center;
1.2 as 266: width: $(($ARG_BIGSIZE - 100))px;
267: margin: 0 50px;
1.1 as 268: }
269: .left {
270: float: left;
271: }
272: .right {
273: float: right;
274: }
275: .clear {
276: clear: both;
277: }
278: -->
279: </style>
280: </head>
281: <body>
282: HTML
283: }
284:
285: #
286: # html_footer()
287: #
288: html_footer()
289: {
290: cat <<HTML
291: </body></html>
292: HTML
293: }
294:
295: #
296: # html_tn()
297: #
298: html_tn()
299: {
300: tn=$1
301: link=$2
302:
303: info=$($BIN_IMGINFO -f $tn)
304: width=$(echo $info | awk '{print $3}')
305: height=$(echo $info | awk '{print $4}')
306: top=$(($(($ARG_TNSIZE - $height)) / 2))
307:
308: cat <<HTML
309: <div class="tn">
310: <a href="$link" style="top:${top}px">
311: <img alt="$tn" width="$width" height="$height" src="$tn" />
312: </a>
313: </div>
314: HTML
315: }
316:
317: #
318: # html_img()
319: #
320: html_img()
321: {
322: img=$1
323: link=$2
324: linkb=$3
325: linkn=$4
326:
1.3 as 327: info=$($BIN_IMGINFO -f $img)
328: width=$(echo $info | awk '{print $3}')
329: height=$(echo $info | awk '{print $4}')
1.1 as 330:
331: if [ "$linkb" != "" ]
332: then
333: hlinkb="<a href='$linkb'>zurück</a>"
334: olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>"
335: fi
336:
337: if [ "$linkn" != "" ]
338: then
339: hlinkn="<a href="$linkn">weiter</a>"
340: olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>"
341: fi
342:
343: cat <<HTML
344: <div class="box">
345: <div class="nav">
1.2 as 346: <div class="top"><a href="$link">Index</a></div>
1.1 as 347: <div class="left">$hlinkb</div>
348: <div class="right">$hlinkn</div>
349: </div>
350: <div class="big">
1.3 as 351: <img alt="$img" width="$width" height="$height" src="$img" />
1.1 as 352: </div>
353: <div class="c">
354: $ARG_TITLE $ARG_COPYRIGHT
355: </div>
356: <div class="over" style='height:${height}px'>
357: $olinkb
358: $olinkn
359: </div>
360: </div>
361: HTML
362: }
363:
364: #
365: # err
366: #
367: err()
368: {
369: echo "$1" >&2
370: exit 1
371: }
372:
373:
374: # parse args
375: while [ "$1" != "" ]
376: do
377: arg=$1
378: shift
379: case $arg in
380: -h)
381: usage
382: ;;
383: -n)
384: ARG_TITLE=$1
385: shift
386: ;;
387: -t)
388: ARG_TNSIZE=$1
389: shift
390: ;;
391: -u)
392: ARG_TNQALITY=$1
393: shift
394: ;;
395: -b)
396: ARG_BIGSIZE=$1
397: shift
398: ;;
399: -c)
400: ARG_BIGQALITY=$1
401: shift
402: ;;
403: -f)
404: ARG_FILES=$1
405: shift
406: ;;
407: -s)
408: ARG_FILETYPES=$1
409: shift
410: ;;
411: -d)
412: ARG_DIR=$1
413: shift
414: ;;
415: -C)
416: ARG_COPYRIGHT=$1
417: shift
418: ;;
419: -U)
420: ARG_UPDATE=0
421: ;;
422: -v)
423: echo $VERSION
424: exit
425: ;;
426: *)
427: echo "unknown argument $arg"
428: exit
429: esac
430: done
431:
432: MY=$(get_my_path)
433: cd "$ARG_DIR" || exit 1
434:
435: # if no images defined, find files
436: if [ "$ARG_FILES" = "" -a "$ARG_FILETYPES" != "" ]
437: then
438: match=
439: for type in $ARG_FILETYPES
440: do
441: match="$match *.$(echo $type | tr '[:lower:]' '[:upper:]')"
442: match="$match *.$(echo $type | tr '[:upper:]' '[:lower:]')"
443: done
444: ARG_FILES=$(cd $ARG_DIR && ls $match 2>/dev/null)
445: fi
446:
447: # Filter big and thumbnails
448: echo -n "find images"
449: FLIST=
450: for file in $ARG_FILES
451: do
452: test $(echo $file | grep -E '\.(tn|big)\.jpg$') && continue
453: FLIST="$FLIST $file"
454: echo -n " $file"
455: done
456: echo
457:
458: test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''"
459:
460: # Create make file to rotate und convert all big and thumbnails.
461: # Is needed to define the new real image sizes.
462: echo "all: tns" > $MKAKEFILE
463: targets=""
464: for file in $FLIST
465: do
466: tn="${file}.tn.jpg"
467: big="${file}.big.jpg"
468: targets="$targets $tn"
469:
470: target=
471: if [ $ARG_UPDATE -eq 1 ]
472: then
473: target="$tn: $ME $file"
474: else
475: target="$tn::"
476: fi
477:
478: (
479: cat <<MAKE
480: $target
481: $BIN_EXIFAUTOTRAN $file
482: $BIN_CONVERT -verbose -thumbnail ${ARG_TNSIZE}x${ARG_TNSIZE} -quality $ARG_TNQALITY $file $tn
483: $BIN_CONVERT -verbose -thumbnail ${ARG_BIGSIZE}x${ARG_BIGSIZE} -quality $ARG_BIGQALITY $file $big
484: MAKE
485: ) >> $MKAKEFILE
486: done
487: echo "tns: $targets" >> $MKAKEFILE
488:
489: make -f $MKAKEFILE
490: rm $MKAKEFILE
491:
492: # create single html files
493: index=""
494: i=0
495: echo -n "create single html files "
496: for file in $FLIST
497: do
498: h=$i
499: i=$(($i + 1))
500: j=$(($i + 1))
501:
502: tn="${file}.tn.jpg"
503: big="${file}.big.jpg"
504: imglink="${file}.html"
505:
506: if [ $i -ne 1 ]
507: then
508: linkb=$(echo $FLIST | awk "{print \$$h}").html
509: fi
510: linkn=$(echo $FLIST | awk "{print \$$j}")
511: test "$linkn" != "" && linkn="$linkn.html"
512:
513: echo -n .
514: index="$index $(html_tn $tn $imglink)"
515: (
516: html_header
517: html_img $big $ARG_INDEX "$linkb" "$linkn"
518: html_footer
519: ) > $imglink
520: done
521: echo
522:
523: # create html index
524: echo create html index
525: (
526: html_header
527: echo $index
528: echo "<div class='clear'></div>"
529: echo "<div class='c'>$ARG_TITLE $ARG_COPYRIGHT</div>"
530: html_footer
531: ) > $ARG_INDEX