]> git.plutz.net Git - shellwiki/blobdiff - macros/gallery
Merge commit '6bc502434737d7f08379e79b94fc6fda424ef779'
[shellwiki] / macros / gallery
index 306c517352237b784d3904467bb047a6cf2c7bdc..edc6a39d1f2240198fb924f728c2940eb9138c82 100755 (executable)
@@ -1,5 +1,19 @@
 #!/bin/sh
 
+# Copyright 2023 Paul Hänsch
+# 
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+# 
+# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
 . "$_EXEC/cgilite/cgilite.sh"
 . "$_EXEC/acl.sh"
 . "$_EXEC/tools.sh"
@@ -16,16 +30,17 @@ for glob in "$@"; do
   && attachment_glob "$glob"
 done \
 | grep -xiE '.*\.jpe?g|.*\.png|.*\.gif' \
-| sort -u \
 | while read attachment; do
   case $attachment in
     */*)
-      printf '<a href="%s"><img src="%s"></a>' \
-             "${attachment%/*}/[attachment]/${attachment##*/}" "${attachment}"
+      printf '<a href="%s"><img alt="" src="%s"></a>' \
+             "$(URL "${attachment%/*}/[attachment]/${attachment##*/}")" \
+             "$(URL "${attachment}")"
       ;;
     *)
-      printf '<a href="%s"><img src="%s"></a>' \
-             "[attachment]/${attachment}" "${attachment}"
+      printf '<a href="%s"><img alt="" src="%s"></a>' \
+             "$(URL "[attachment]/${attachment}")" \
+             "$(URL "${attachment}")"
       ;;
   esac
 done