(/ (* 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
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
(insert "<body>\n")
(insert (format "<h1>%s</h1>\n"
(file-name-nondirectory file-base)))
+
+ (if prev-file
+ (insert (format "<a href=\"%s.html\">"
+ (file-name-sans-extension
+ (file-name-nondirectory prev-file)))))
+ (insert "[Previous]")
+ (if prev-file
+ (insert "</a>"))
+ (insert "\n")
+
+ (if next-file
+ (insert (format "<a href=\"%s.html\">"
+ (file-name-sans-extension
+ (file-name-nondirectory next-file)))))
+ (insert "[Next]")
+ (if next-file
+ (insert "</a>"))
+ (insert "\n")
+
+ (if prev-grade
+ (insert (format "<a href=\"../%s/%s.html\">"
+ prev-grade
+ (file-name-nondirectory file-base))))
+ (insert "[Smaller]")
+ (if prev-grade
+ (insert "</a>"))
+ (insert "\n")
+
+ (if next-grade
+ (insert (format "<a href=\"../%s/%s.html\">"
+ next-grade
+ (file-name-nondirectory file-base))))
+ (insert "[Larger]")
+ (if next-grade
+ (insert "</a>"))
+ (insert "\n")
+
(insert "
<hr>
")
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)
(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))
(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
(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"
(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))))