index.tpl 708 B

12345678910111213141516171819202122
  1. % query="$(echo "$QUERY_STRING" | sed -e 's/query=//' -e 's/+/ /g')"
  2. % result="$(img-chon.sh query $query)"
  3. % count="$(echo "$result" | wc -l)"
  4. % tags="$(img-chon.sh tags | tr '\n' ' ')"
  5. % ntags="$(echo "$tags" | wc -w)"
  6. <form>
  7. <input name="query" value="%($query%)" />
  8. <input type="submit" />
  9. <span>%($count%) results.</span>
  10. <span>%($ntags%) tags available: %($tags%)</span>
  11. </form>
  12. % mkfifo /tmp/fifofifo
  13. % img-chon.sh query-thumb $query > /tmp/fifofifo &
  14. % echo "$result" | ./bin/urldecode.awk | paste - /tmp/fifofifo | awk -F'\t' '{
  15. % print "<a href=\"" $1 "\">"
  16. % print " <img src=\"data:image/jpeg;charset=utf-8;base64, " $2 "\" />"
  17. % print "</a>"
  18. % }'
  19. % rm /tmp/fifofifo