From d707817b333de9c723ddc1df98c81093d8234918 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 30 Oct 2026 08:56:33 +0100 Subject: examples: resurrect gipfelweb on the Rust stack Port of the pre-Rust static web gallery pipeline (recovered from history): Makefile drives gipfel-cli export-position/export-hills instead of the C binary, ImageMagick replaces netpbm + jhead (convert preserves the gipfel comment and EXIF natively). Output structure and the CSS-only hover interaction are unchanged for now; modernization follows separately. gipfel2html: cross-image references now match the name column exactly (the old grep -l also matched substrings, e.g. test.jpg inside contest.jpg). Verified end to end with two annotated test panoramas: slides, thumbs, positions, cross-links and hill markers all generate. --- examples/Makefile | 83 ++++++++++++++++++++++++++++++ examples/gipfel2html | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 examples/Makefile create mode 100755 examples/gipfel2html (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..ac44fb7 --- /dev/null +++ b/examples/Makefile @@ -0,0 +1,83 @@ +# gipfelweb: static, CSS-only web galleries of gipfel-annotated +# panoramas. Port of the historical examples/ pipeline to the Rust +# stack: gipfel-cli replaces the C binary, ImageMagick replaces +# netpbm + jhead (convert preserves the gipfel comment and EXIF). +# +# usage: put annotated *.jpg files (optionally per-image %.opts with +# extra gipfel-cli arguments and %.title with a display title) in a +# directory and run +# +# make -f /path/to/gipfel/examples/Makefile gipfelweb +# +# variables: +# GIPFEL_CLI path to the gipfel-cli binary +# DATA hill database used for the peak view +# GIPFEL2HTML html generator script + +here := $(dir $(lastword $(MAKEFILE_LIST))) +GIPFEL_CLI ?= $(abspath $(here)../target/release/gipfel-cli) +DATA ?= $(abspath $(here)../gipfel.dat) +GIPFEL2HTML ?= $(here)gipfel2html + +images := $(wildcard *.jpg) +slides := $(addprefix gipfelweb/slides/, $(images)) +thumbs := $(addprefix gipfelweb/thumbs/, $(images)) +positions := $(addprefix gipfelweb/gipfel/, $(addsuffix .pos, $(basename $(images)))) +imgpos := $(addprefix gipfelweb/gipfel/, $(addsuffix .imgs, $(basename $(images)))) +hillpos := $(addprefix gipfelweb/gipfel/, $(addsuffix .hills, $(basename $(images)))) +html := $(addprefix gipfelweb/, $(addsuffix .html, $(basename $(images)))) +htmlhills := $(addprefix gipfelweb/hills/, $(addsuffix .html, $(basename $(images)))) + +all: + echo "make gipfelweb - create a HTML based view of gipfel oriented" + echo "images in the current directory." + +gipfelweb: dirs $(slides) $(thumbs) $(imgpos) $(hillpos) $(html) $(htmlhills) + +clean: + rm -rf gipfelweb/gipfel + +clobber: + rm -rf gipfelweb + +dirs: + mkdir -p gipfelweb/slides + mkdir -p gipfelweb/thumbs + mkdir -p gipfelweb/hills + mkdir -p gipfelweb/gipfel + +gipfelweb/slides/%.jpg: %.jpg + convert $< -filter Lanczos -resize 20000x500\> -quality 94 $@ + +gipfelweb/thumbs/%.jpg: %.jpg + convert $< -filter Point -resize 400x50\> -quality 80 $@ + +gipfelweb/gipfel/%.pos: %.jpg + $(GIPFEL_CLI) export-position $< > $@ + +gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg %.opts gipfelweb/gipfel/index.gipfel + $(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@ + +gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg gipfelweb/gipfel/index.gipfel + $(GIPFEL_CLI) export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@ + +gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg %.opts + $(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) > $@ + +gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg + $(GIPFEL_CLI) export-hills $< -d $(DATA) > $@ + +gipfelweb/gipfel/index.gipfel: $(positions) + cat $(positions) > gipfelweb/gipfel/index.gipfel + +gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.imgs %.title $(thumbs) + $(GIPFEL2HTML) images "`cat $*.title`" $* > $@ + +gipfelweb/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.imgs $(thumbs) + $(GIPFEL2HTML) images $* $* > $@ + +gipfelweb/hills/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.hills %.title + $(GIPFEL2HTML) hills "`cat $*.title`" $* > $@ + +gipfelweb/hills/%.html: gipfelweb/slides/%.jpg gipfelweb/gipfel/%.hills + $(GIPFEL2HTML) hills $* $* > $@ diff --git a/examples/gipfel2html b/examples/gipfel2html new file mode 100755 index 0000000..49814c3 --- /dev/null +++ b/examples/gipfel2html @@ -0,0 +1,139 @@ +#!/bin/sh + +MODE="$1" +TITLE="$2" +FILE="$3" + +if [ "$MODE" = "images" ]; then + DATAFILE="gipfelweb/gipfel/${FILE}.imgs" +else + DATAFILE="gipfelweb/gipfel/${FILE}.hills" +fi + +cat << EOF + + + +EOF + +echo "$TITLE" + +cat << EOF + + +
+
+EOF + +echo "

$TITLE

" + +if [ "$MODE" = "images" ]; then + echo "show hill names" +else + echo "back to gipfelweb" +fi + +cat << EOF + + +
+ + +
+
+EOF + +if [ "$MODE" = "images" ]; then + echo "" +else + echo "" +fi + + +echo "
    " +i=0 +grep -v "^#" ${DATAFILE} | \ +while read name height x y dist flags dummy; do + if [ "$MODE" = "images" ]; then + THUMB_TITLE="${name%.jpg}" + if [ -e "${name%.jpg}.title" ]; then + THUMB_TITLE=`cat ${name%.jpg}.title` + fi + echo "
  • ${THUMB_TITLE} (${height}m)
  • " + else + echo "
  • ${name} (${height}m)
  • " + fi + + i=$((${i} + 1)) +done +echo "
" + +cat << EOF +
+
+
+
+Created with gipfel +
+
+EOF + +if [ "$MODE" = "images" ]; then + echo Move the mouse over the image to see other images. +else + echo Move the mouse over the image to see known mountains. +fi + +cat << EOF +
+Move the mouse over the rectangle to see details. +
+
+This image is visible on these images:
+EOF + +# exact match on the name column (a plain grep -l would also match +# substrings, e.g. test.jpg inside contest.jpg); exit keeps output to +# one line per file +awk -F'\t' -v n="${FILE}.jpg" '$1 == n { print FILENAME; exit }' gipfelweb/gipfel/*.imgs | \ +while read f; do + img="`basename ${f%.imgs}`" + if [ "$MODE" = "images" ]; then + echo "
" + else + echo "
" + fi +done + + +cat << EOF + + +EOF -- cgit v1.2.3