From: tomo Date: Fri, 15 Apr 2005 13:55:44 +0000 (+0000) Subject: (www-image-write-html): Add new argument `prev-file', `next-file' and X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=586ca9302f53679812f6a456781ef1a5f222aa60;p=elisp%2Falbum.git (www-image-write-html): Add new argument `prev-file', `next-file' and `prev-grade'; add links for `prev-file', `next-file', `prev-grade' and `next-grade'. (www-image-convert-images): New optional argument `prev-file' and `next-file'; modify for `www-image-write-html'. --- diff --git a/www-image.el b/www-image.el index d6b397b..619b0b4 100644 --- a/www-image.el +++ b/www-image.el @@ -12,7 +12,9 @@ (/ (* width percent) 100.0) (/ (* height percent) 100.0))))) -(defun www-image-write-html (file-base grade next-grade) +(defun www-image-write-html (file-base grade + prev-file next-file + prev-grade next-grade) (with-temp-buffer (insert "\n") (insert (format "

%s

\n" (file-name-nondirectory file-base))) + + (if prev-file + (insert (format "" + (file-name-sans-extension + (file-name-nondirectory prev-file))))) + (insert "[Previous]") + (if prev-file + (insert "")) + (insert "\n") + + (if next-file + (insert (format "" + (file-name-sans-extension + (file-name-nondirectory next-file))))) + (insert "[Next]") + (if next-file + (insert "")) + (insert "\n") + + (if prev-grade + (insert (format "" + prev-grade + (file-name-nondirectory file-base)))) + (insert "[Smaller]") + (if prev-grade + (insert "")) + (insert "\n") + + (if next-grade + (insert (format "" + next-grade + (file-name-nondirectory file-base)))) + (insert "[Larger]") + (if next-grade + (insert "")) + (insert "\n") + (insert "
") @@ -58,7 +97,7 @@ grade (file-name-nondirectory file-base))))) -(defun www-image-convert-images (filename) +(defun www-image-convert-images (filename &optional prev-file next-file) (let* ((ret (with-temp-buffer (call-process "identify" nil t t filename) @@ -68,6 +107,7 @@ (string-to-number (match-string 2)))))) (width (car ret)) (height (cdr ret)) + prev-grade rest dest) (cond ((>= width height) (when (setq ret (www-image-make-spec-by-width width 2048 'QXGA)) @@ -106,6 +146,8 @@ (setq spec (car rest)) (www-image-write-html (file-name-sans-extension filename) (aref spec 1) + prev-file next-file + prev-grade (if (nth 1 rest) (aref (nth 1 rest) 1))) (call-process "convert" nil nil nil @@ -116,6 +158,7 @@ (aref spec 1) (file-name-sans-extension (file-name-nondirectory filename)))) + (setq prev-grade (aref spec 1)) (setq rest (cdr rest))) (unless (file-exists-p (expand-file-name "fullsize" @@ -131,7 +174,18 @@ (file-name-nondirectory filename)))) dest)) -(dolist (file - (directory-files - "/archives/RAID2/koukotsu/TAKUHON/" t "\\.TIF$")) - (www-image-convert-images file)) +(let ((rest + (append + (directory-files + "/archives/RAID2/koukotsu/TAKUHON/" t "^[^0-9].*\\.TIF$") + (directory-files + "/archives/RAID2/koukotsu/TAKUHON/" t "^[0-9].*\\.TIF$")) + ;; (directory-files + ;; "/archives/RAID2/koukotsu/TAKUHON/" t "\\.TIF$") + ) + file prev-file) + (while rest + (setq file (car rest)) + (www-image-convert-images file prev-file (nth 1 rest)) + (setq prev-file file + rest (cdr rest))))