First the thumbnail images must be created. I use 'convert' to do that. The
following one line shell script is used to do this. It iterates over all
files in the directory and generates thumbnails for them.
#!/bin/sh mkdir -p thumbs for img in *.jpg ; do convert -resize 240x180 $img thumbs/$img ; doneThen the following was added to my
.emacs to add support for a tag to
specify thumbnails.
;; emacs-wiki is needed (require 'emacs-wiki) ;; Handle <thumb> tags properly... (defun sd-emacs-wiki-thumbnail-tag (beg end attrs highlight-p) (if highlight-p (goto-char end) (let ((end-marker (set-marker (make-marker) (1+ end)))) (save-restriction (narrow-to-region beg end) (let ((image-list (split-string (buffer-substring beg end) nil t))) (delete-region beg end) (goto-char (point-min)) (insert "<p>\n") (loop for image in image-list do (let ((dir (or (file-name-directory image) "")) (file (file-name-nondirectory image))) (insert (format " <a href=\"%s\">" image)) (insert (format " <img src=\"%sthumbs/%s\"></a>\n" dir file)))) (insert "</p>\n") (add-text-properties (point-min) (point-max) '(rear-nonsticky (read-only) read-only t)))) (goto-char end-marker)))) ;; Generate links to go to previous and next pages... (defun sd-emacs-wiki-nav-tag (beg end attrs highlight-p) (if highlight-p (goto-char end) (let ((end-marker (set-marker (make-marker) (1+ end)))) (save-restriction (narrow-to-region beg end) (let ((links (split-string (buffer-substring beg end) nil t))) (setq links (loop for x in links collect (if (equal x "Dummy") nil x))) (delete-region beg end) (insert "<hr class=\"nav\">\n") (when (car links) (insert "<div style=\"float: left;\">Prev: " (format "<a href=\"%s.html\">%s</a></div>\n" (car links) (car links)))) (when (cadr links) (insert "<div style=\"float: right;\">Next: " (format "<a href=\"%s.html\">%s</a></div>\n" (cadr links) (cadr links)))) (insert "<br>")) (add-text-properties (point-min) (point-max) '(rear-nonsticky (read-only) read-only t))) (goto-char end-marker)))) ;; Tell emacs-wiki about the new tags... (push '("thumb" t t t sd-emacs-wiki-thumbnail-tag) emacs-wiki-markup-tags) (push '("nav" t t t sd-emacs-wiki-nav-tag) emacs-wiki-markup-tags)Now you can use the following in an emacs-wiki page and it will show up with proper links and all:
Write some snide comments about the people in the picture. Then just list the image file names that need to be displayed: <thumb> pic1.jpg pic2.jpg pic3.jpg </thumb>