Browse Source

Add site: img.tankernn.eu

The site uses img-chon.sh from Tankernn/dotfiles.git as backend.
Frans Bergman 2 months ago
parent
commit
0aa03d2fe3
2 changed files with 24 additions and 0 deletions
  1. 2 0
      sites/img.tankernn.eu/_wesh/config
  2. 22 0
      sites/img.tankernn.eu/index.tpl

+ 2 - 0
sites/img.tankernn.eu/_wesh/config

@@ -0,0 +1,2 @@
+siteTitle='img-chon.sh'
+siteSubTitle='find images using tags'

+ 22 - 0
sites/img.tankernn.eu/index.tpl

@@ -0,0 +1,22 @@
+% query="$(echo "$QUERY_STRING" | sed -e 's/query=//' -e 's/+/ /g')"
+% result="$(img-chon.sh query $query)"
+% count="$(echo "$result" | wc -l)"
+% tags="$(img-chon.sh tags | tr '\n' ' ')"
+% ntags="$(echo "$tags" | wc -w)"
+
+<form>
+    <input name="query" value="%($query%)" />
+    <input type="submit" />
+    <span>%($count%) results.</span>
+    <span>%($ntags%) tags available: %($tags%)</span>
+</form>
+
+% mkfifo /tmp/fifofifo
+% img-chon.sh query-thumb $query > /tmp/fifofifo &
+% echo "$result" | ./bin/urldecode.awk | paste - /tmp/fifofifo | awk -F'\t' '{
+%    print "<a href=\"" $1 "\">"
+%    print "  <img src=\"data:image/jpeg;charset=utf-8;base64, " $2 "\" />"
+%    print "</a>"
+% }'
+% rm /tmp/fifofifo
+