Annotation of scripts/pgallery/src/libpgallery.sh, revision 1.1
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: #
! 8: # $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.17 2012/08/29 14:44:04 as Exp $
! 9: #
! 10:
! 11: BIN_CONVERT="/usr/local/bin/convert"
! 12: BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran"
! 13: BIN_IMGINFO="/usr/local/bin/imginfo"
! 14: BIN_SENDMAIL="/usr/sbin/sendmail"
! 15: BIN_EXIFTRAN="/usr/local/bin/exiftran"
! 16: BIN_EXIF="/usr/local/bin/exif"
! 17:
! 18: ARGFILE=".htpgallery"
! 19: VERSION="pgallery-1.3"
! 20:
! 21: #
! 22: # get_my_path()
! 23: #
! 24: get_my_path()
! 25: {
! 26: current=$(pwd)
! 27: cd $(dirname $0)
! 28: echo $(pwd)/$(basename $0)
! 29: cd "$current"
! 30: }
! 31:
! 32: #
! 33: # html_header()
! 34: #
! 35: html_header()
! 36: {
! 37: cat <<HTML
! 38: <?xml version="1.0" encoding="utf-8"?>
! 39: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
! 40: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
! 41: <html xmlns="http://www.w3.org/1999/xhtml">
! 42: <head>
! 43: <title>$ARG_TITLE</title>
! 44: <meta http-equiv="content-type" content="text/html; charset=utf-8" />
! 45: <style type="text/css">
! 46: <!--
! 47: body {
! 48: background-color: #464646;
! 49: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYB\
! 50: AMAAACDuy0HAAAAG1BMVEX+/v4BAQH///8KCgoDAwN/f3/19fWAgID8/PzhDwT2AAAACXRSTlMFBQUFBQU\
! 51: F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/hA5RnMNE4fDK0pVOQ4B\
! 100: HLaErzv/wD99ABmjNZk0AAAAABJRU5ErkJggg==");
! 101: margin: 10px auto;
! 102: font-family: Geneva,Arial,sans-serif;
! 103: font-size: 12px;
! 104: text-shadow: 1px 1px 1px #000;
! 105: color: #808080;
! 106: }
! 107: div.tn {
! 108: float: left;
! 109: width: ${ARG_TNSIZE}px;
! 110: vertical-align:text-top;
! 111: text-align: center;
! 112: margin: 4px;
! 113: }
! 114: div.t {
! 115: height: 20px;
! 116: line-height: 18px;
! 117: text-overflow: ellipsis;
! 118: overflow: hidden;
! 119: white-space: nowrap;
! 120: width: $(($ARG_TNSIZE - 8))px;
! 121: padding: 0 4px;
! 122: margin-bottom: 1px;
! 123: background: rgb(38,38,38); /* Old browsers */
! 124: background: -moz-linear-gradient(top, rgba(38,38,38,1) 0%, rgba(53,53,53,1) 50%, rgba(48,48,48,1) 51%, rgba(73,73,73,1) 100%); /* FF3.6+ */
! 125: background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(38,38,38,1)), color-stop(50%,rgba(53,53,53,1)), color-stop(51%,rgba(48,48,48,1)), color-stop(100%,rgba(73,73,73,1))); /* Chrome,Safari4+ */
! 126: background: -webkit-linear-gradient(top, rgba(38,38,38,1) 0%,rgba(53,53,53,1) 50%,rgba(48,48,48,1) 51%,rgba(73,73,73,1) 100%); /* Chrome10+,Safari5.1+ */
! 127: background: -o-linear-gradient(top, rgba(38,38,38,1) 0%,rgba(53,53,53,1) 50%,rgba(48,48,48,1) 51%,rgba(73,73,73,1) 100%); /* Opera 11.10+ */
! 128: background: -ms-linear-gradient(top, rgba(38,38,38,1) 0%,rgba(53,53,53,1) 50%,rgba(48,48,48,1) 51%,rgba(73,73,73,1) 100%); /* IE10+ */
! 129: background: linear-gradient(to bottom, rgba(38,38,38,1) 0%,rgba(53,53,53,1) 50%,rgba(48,48,48,1) 51%,rgba(73,73,73,1) 100%); /* W3C */
! 130: filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#262626', endColorstr='#494949',GradientType=0 ); /* IE6-9 */
! 131: }
! 132: div.tn a {
! 133: position: relative;
! 134: display: inline-block;
! 135: height: ${ARG_TNSIZE}px;
! 136: }
! 137: div.tn, div.big {
! 138: background-color: black;
! 139: border-width: 1px;
! 140: border-style: solid;
! 141: border-color: gray;
! 142: box-shadow: 1px 1px 2px #000;
! 143: padding: 1px;
! 144: border-radius: 3px;
! 145: }
! 146: div.tn:hover {
! 147: background-color: #222;
! 148: }
! 149: div.big {
! 150: display: inline-block;
! 151: width: ${ARG_BIGSIZE}px;
! 152: }
! 153: div.over {
! 154: width: ${ARG_BIGSIZE}px;
! 155: position: absolute;
! 156: top: 30px;
! 157: padding: 1px;
! 158: }
! 159: div.over a.left, div.over a.right {
! 160: display: block;
! 161: /* shell fuck of: missing CTLARI (shouldn't happen) - WTF?! */
! 162: width: $(($ARG_BIGSIZE / 2))px;
! 163: position: relative;
! 164: top: 1px;
! 165: left: 1px;
! 166: background-repeat: no-repeat;
! 167: }
! 168: div.over a.left:hover {
! 169: background-position: 5% center;
! 170: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
! 171: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAh9JREFUeNrE2L1Lw0A\
! 172: UAHATSivSZii0ldpBnMU6SgYJpQUJDlk7dLV+LTqIiIv4B7kLolBKQRA6GLqUDMEhqKAlhUIR4125SHo0b\
! 173: XJ51x68pDSX+3G5I/dyguM4S/MuMfeHIAiQ7Yo+//+OocAYPm+jWEXxg8JC8erCgvt4AXrqgkkUJRRZ6jq\
! 174: G71EMRcAeil6wWq2uGYZx1ul0jjRNy5Jey6PauKcRJ5NIhklCoaE4QODNYDCwHVJ6vd5HIpE4xNdQxKOiM\
! 175: 0G3FIvFc4Imo6CBQV3XXwioje5jREOBkiQdE3SLFWUFFXJfaJQVLP2DIWdvFDA+9pYKiMKBAVFYMAAKD85\
! 176: A+YBTUH6gD8oXnIDyB31QviCFzgekUPxYVe4ghW7ixhRFueQKUmgZN9hut1s0aNv2V6FQOAUBqRvT+IAaX\
! 177: 6crWZb1hsqQJFfPkPnpJz6YpmnQlXK5XD6TycRIcrUDib7jQ71ev+v3+9/eSqlUKt1qtU4IvIFid2x9jDC\
! 178: muJE9PG6qql7jcaTHttvt6gh2J1MZYva6ees+d9jnjcQXnoDyh31WGb7wlPWUHzwjc+ADB8iR4OGA2SAsH\
! 179: CLvhYNDZvgwMMO3THSY8auNBS6xfrVFhZUoaGjYk+qA7DkEgmu12i1Bs1C7K1NhvLviecTLEOhEuFKpXDW\
! 180: bzcdGo/Egy/KFZzKJPHbMVsiEyVPXTRRPeMdMWMQuqLi0gPInwACOBcZx3lRFMwAAAABJRU5ErkJggg==");
! 181: }
! 182: div.over a.right:hover {
! 183: background-position: 95% center;
! 184: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAwC\
! 185: AYAAADtoXHnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAiJJREFUeNrE2D1Lw0A\
! 186: YAOAmlNbBdii0FVM6OEu7SgcJpRUJDlk7dE21uuggIi7iD/IX+AGlFAXBDqVLyVCCBBW0JFhwMN7JHRxnY\
! 187: 5PcnX3hhSM58nB3+Xhzkud5sf8OiWjLPn2+eGF4gHEChLkOcgUdt0E+isAlhCVAbiGQjGeQ1yBdHjAeKZ7\
! 188: SCgR1Xc8Nh8M90zQPG42GAo7lQFZBLhOzwSXgKI1kMrk7mUxePBTT6dQB8Dk8B1IHmUbTLrOMFI8WjsIol\
! 189: 8tHHhW8YRKV0QWNwWDwIBKm0RK8aDqdbouEaRReQBUNkygJV0XCNBojnldh8CxUOOyHCoX/QoXB81AhcBC\
! 190: UOxwU5QqHQbnBYVFWODLKDEdFo8IanGYWNBSsquoJgkus6C+4UCgcOI7zRsP9fv8OoTWM8qh57mHlaFnWp\
! 191: 23bFn1SUZQiambm1bphYgMWddlsNp7P51fpk+Px2ETNV1YUf383Qa5BsNfr7adSqQzZyXXd91ardUmUs8x\
! 192: rWYNrBcD2aDQa0GsJ11fTtDO0ntssd28UcAfXzSxvpLBg5DcSKyhH/cowgVG+p8xg2MqBCximRuIGBq0Gu\
! 193: YJB6l7u4LwKXwjo9y8jFPT7a6uKBGehqmiQRhO45BAJ0ijcQTGazeaFSJBGl/DUkrsrvMFZa/pzE1UqleN\
! 194: Op3PV7XZv6vX6KU+QRMkdM3gzFal+TyBvQX7w3DGTFrELKscWEN8CDADBm8pgcciwqgAAAABJRU5ErkJgg\
! 195: g==");
! 196: }
! 197: div.big a {
! 198: position: relative;
! 199: display: inline-block;
! 200: width: ${ARG_BIGSIZE}px;
! 201: }
! 202: div.box {
! 203: text-align: center;
! 204: width: ${ARG_BIGSIZE}px;
! 205: margin: auto;
! 206: }
! 207: div.box div.d {
! 208: width: ${ARG_BIGSIZE}px;
! 209: padding: 5px;
! 210: text-align: center;
! 211: }
! 212: div.box div.i {
! 213: width: ${ARG_BIGSIZE}px;
! 214: font-size: 90%;
! 215: height: 25px;
! 216: line-height: 25px;
! 217: position: relative;
! 218: }
! 219: body > div.c {
! 220: text-align: center;
! 221: font-size: 90%;
! 222: height: 25px;
! 223: line-height: 25px;
! 224: position: relative;
! 225: margin: 4px;
! 226: }
! 227: a img {
! 228: border-width: 0;
! 229: }
! 230: a {
! 231: }
! 232: div.nav {
! 233: width: ${ARG_BIGSIZE}px;
! 234: height: 20px;
! 235: }
! 236: div.nav a {
! 237: color: #FFF;
! 238: text-decoration: none;
! 239: }
! 240: div.nav a:hover {
! 241: text-decoration: underline;
! 242: }
! 243: div.nav div.top {
! 244: position: absolute;
! 245: text-align: center;
! 246: width: $(($ARG_BIGSIZE - 100))px;
! 247: margin: 0 50px;
! 248: }
! 249: .left {
! 250: float: left;
! 251: }
! 252: .right {
! 253: float: right;
! 254: }
! 255: .clear {
! 256: clear: both;
! 257: }
! 258: -->
! 259: </style>
! 260: </head>
! 261: <body>
! 262: HTML
! 263: }
! 264:
! 265: #
! 266: # html_footer()
! 267: #
! 268: html_footer()
! 269: {
! 270: cat <<HTML
! 271: </body></html>
! 272: HTML
! 273: }
! 274:
! 275: #
! 276: # html_tn()
! 277: #
! 278: html_tn()
! 279: {
! 280: tn=$1
! 281: link=$2
! 282: title="$3"
! 283:
! 284: info=$($BIN_IMGINFO -f $tn)
! 285: width=$(echo $info | awk '{print $3}')
! 286: height=$(echo $info | awk '{print $4}')
! 287: top=$(($(($ARG_TNSIZE - $height)) / 2))
! 288:
! 289: test "$title" != "" && title="<div class='t'>$title</div>"
! 290:
! 291: cat <<HTML
! 292: <div class="tn">
! 293: $title
! 294: <a href="$link" style="top:${top}px">
! 295: <img alt="$tn" width="$width" height="$height" src="$tn" />
! 296: </a>
! 297: </div>
! 298: HTML
! 299: }
! 300:
! 301: #
! 302: # html_img()
! 303: #
! 304: html_img()
! 305: {
! 306: orig=$1
! 307: num=$2
! 308: all=$3
! 309: img=$4
! 310: link=$5
! 311: linkb=$6
! 312: linkn=$7
! 313:
! 314: info=$($BIN_IMGINFO -f $img)
! 315: width=$(echo $info | awk '{print $3}')
! 316: height=$(echo $info | awk '{print $4}')
! 317:
! 318: desc=$(get_exif_desc $orig)
! 319: if [ "$desc" != "" ]
! 320: then
! 321: desc="<div class='d'>$desc</div>"
! 322: fi
! 323:
! 324: if [ "$linkb" != "" ]
! 325: then
! 326: hlinkb="<a href='$linkb'>prev</a>"
! 327: olinkb="<a class='left' style='height:${height}px' href='$linkb'></a>"
! 328: fi
! 329:
! 330: if [ "$linkn" != "" ]
! 331: then
! 332: hlinkn="<a href="$linkn">next</a>"
! 333: olinkn="<a class='right' style='height:${height}px' href='$linkn'></a>"
! 334: fi
! 335:
! 336: cat <<HTML
! 337: <div class="box">
! 338: <div class="nav">
! 339: <div class="top">
! 340: <a href="$link">index</a> | <a href="$orig">original</a> | $num/$all
! 341: </div>
! 342: <div class="left">$hlinkb</div>
! 343: <div class="right">$hlinkn</div>
! 344: </div>
! 345: <div class="big">
! 346: <img alt="$img" width="$width" height="$height" src="$img" />
! 347: </div>
! 348: $desc
! 349: <div class="i">
! 350: <div class="left">$(get_exif_info $orig)</div>
! 351: <div class="right">$ARG_TITLE $ARG_COPYRIGHT</div>
! 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: # mysendmail()
! 372: #
! 373: mysendmail()
! 374: {
! 375: subject=$1
! 376: (
! 377: cat <<MAIL
! 378: From: $ARG_MAILFROM
! 379: To: $ARG_MAILTO
! 380: Subject: $subject
! 381: Content-Type: text/plain; charset=iso-8859-1
! 382: X-Mailer: $VERSION
! 383:
! 384: $(cat)
! 385: MAIL
! 386: ) | $BIN_SENDMAIL -t
! 387: }
! 388:
! 389: #
! 390: # get_exif_desc()
! 391: #
! 392: get_exif_desc()
! 393: {
! 394: img=$1
! 395: $BIN_EXIF --ifd=0 --tag=0x010e -m $img 2> /dev/null | while read line
! 396: do
! 397: echo "$line<br />"
! 398: done
! 399: }
! 400:
! 401: #
! 402: # get_exif_ts()
! 403: #
! 404: get_exif_ts()
! 405: {
! 406: img=$1
! 407: date=$($BIN_EXIF --ifd=EXIF --tag=0x9003 -m $img 2> /dev/null)
! 408: if [ "$date" = "" ]
! 409: then
! 410: echo "-1"
! 411: return 1
! 412: fi
! 413: date -j -f "%Y:%m:%d %T" "$date" "+%s"
! 414: }
! 415:
! 416: #
! 417: # get_exif_date()
! 418: #
! 419: get_exif_date()
! 420: {
! 421: img=$1
! 422: ts=$(get_exif_ts $img) && date -r $ts "+%d.%m.%Y %H:%M" || echo ""
! 423: }
! 424:
! 425: #
! 426: # get_exif_value()
! 427: #
! 428: get_exif_value()
! 429: {
! 430: img=$1
! 431: hex=$2
! 432: $BIN_EXIFTRAN -d $img | grep $hex | sed -E 's/^.{45}//'
! 433: }
! 434:
! 435: #
! 436: # get_exif_info()
! 437: #
! 438: get_exif_info()
! 439: {
! 440: img=$1
! 441:
! 442: exifinfo=
! 443: created=$(get_exif_date $img) && exifinfo="$created / "
! 444:
! 445: for exif in $ARG_EXIF
! 446: do
! 447: if echo $exif | grep -q -E '0x[[:alnum:]]{4}'
! 448: then
! 449: exifinfo="$exifinfo$(get_exif_value $img $exif) "
! 450: else
! 451: exifinfo="$exifinfo$exif "
! 452: fi
! 453: done
! 454: echo $exifinfo | sed -E -e 's/ mm /mm /' -e 's/ se(c|k)./s/' -e 's/ ISO / ISO/' -e 's/ ISO(\/| )/ \1/'
! 455: }
! 456:
! 457: #
! 458: # is_in_list()
! 459: #
! 460: is_in_list()
! 461: {
! 462: list=$1
! 463: value=$2
! 464: for entry in $list
! 465: do
! 466: test "$entry" = "$value" && return 0
! 467: done
! 468: return 1
! 469: }