1 (defun www-image-make-spec-by-width (width limit spec-name)
3 (let ((percent (floor (/ (* limit 100.0) width))))
4 (vector percent spec-name
5 (/ (* width percent) 100.0)
6 (/ (* height percent) 100.0)))))
8 (defun www-image-make-spec-by-height (height limit spec-name)
10 (let ((percent (floor (/ (* limit 100.0) height))))
11 (vector percent spec-name
12 (/ (* width percent) 100.0)
13 (/ (* height percent) 100.0)))))
15 (defun www-image-write-html (dest-dir
16 prev-file file next-file
17 prev-grade grade next-grade)
20 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
21 \"http://www.w3.org/TR/html4/loose.dtd\">\n")
23 (insert (format "<title>%s</title>\n" file))
26 (insert (format "<h1>%s</h1>\n" file))
29 (insert (format "<a href=\"%s.html\">" prev-file)))
36 (insert (format "<a href=\"%s.html\">" next-file)))
43 (insert (format "<a href=\"../%s/%s.html\">"
52 (insert (format "<a href=\"../%s/%s.html\">"
66 (format "../%s/%s.html" next-grade file)
67 (concat "../fullsize/" file ".jpg")))
69 (insert (format "<img alt=\"%s\" src=\"%s.jpg\">" file file))
77 (unless (file-exists-p
78 (expand-file-name (symbol-name grade) dest-dir))
80 (expand-file-name (symbol-name grade) dest-dir)))
81 (write-region (point-min)(point-max)
84 (expand-file-name (symbol-name grade)
87 (defun www-image-convert-images (dest-dir
88 prev-file file next-file)
91 (call-process "identify" nil t t file)
92 (goto-char (point-min))
93 (and (re-search-forward " \\([0-9]+\\)x\\([0-9]+\\) " nil t)
94 (cons (string-to-number (match-string 1))
95 (string-to-number (match-string 2))))))
100 (cond ((>= width height)
101 (when (setq ret (www-image-make-spec-by-width width 2048 'QXGA))
102 (setq dest (cons ret dest)))
103 (when (setq ret (www-image-make-spec-by-width width 1600 'UXGA))
104 (setq dest (cons ret dest)))
105 (when (setq ret (www-image-make-spec-by-width width 1400 'SXGA+))
106 (setq dest (cons ret dest)))
107 (when (setq ret (www-image-make-spec-by-width width 1280 'SXGA))
108 (setq dest (cons ret dest)))
109 (when (setq ret (www-image-make-spec-by-width width 1024 'XGA))
110 (setq dest (cons ret dest)))
111 (when (setq ret (www-image-make-spec-by-width width 800 'SVGA))
112 (setq dest (cons ret dest)))
113 (when (setq ret (www-image-make-spec-by-width width 640 'VGA))
114 (setq dest (cons ret dest)))
117 (when (setq ret (www-image-make-spec-by-height height 1536 'QXGA))
118 (setq dest (cons ret dest)))
119 (when (setq ret (www-image-make-spec-by-height height 1200 'UXGA))
120 (setq dest (cons ret dest)))
121 (when (setq ret (www-image-make-spec-by-height height 1050 'SXGA+))
122 (setq dest (cons ret dest)))
123 (when (setq ret (www-image-make-spec-by-height height 960 'SXGA))
124 (setq dest (cons ret dest)))
125 (when (setq ret (www-image-make-spec-by-height height 768 'XGA))
126 (setq dest (cons ret dest)))
127 (when (setq ret (www-image-make-spec-by-height height 600 'SVGA))
128 (setq dest (cons ret dest)))
129 (when (setq ret (www-image-make-spec-by-height height 480 'VGA))
130 (setq dest (cons ret dest)))
134 (setq spec (car rest))
135 (www-image-write-html dest-dir
137 (file-name-sans-extension
138 (file-name-nondirectory prev-file)))
139 (file-name-sans-extension
140 (file-name-nondirectory file))
142 (file-name-sans-extension
143 (file-name-nondirectory next-file)))
147 (aref (nth 1 rest) 1)))
148 (call-process "convert" nil nil nil
149 "-resize" (format "%d%%" (aref spec 0))
153 (file-name-sans-extension
154 (file-name-nondirectory file)) ".jpg")
156 (symbol-name (aref spec 1))
158 (setq prev-grade (aref spec 1))
159 (setq rest (cdr rest)))
160 (unless (file-exists-p
161 (expand-file-name "fullsize" dest-dir))
163 (expand-file-name "fullsize" dest-dir)))
164 (call-process "convert" nil nil nil
168 (file-name-sans-extension
169 (file-name-nondirectory file)) ".jpg")
170 (expand-file-name "fullsize" dest-dir)))
176 "/archives/RAID2/koukotsu/TAKUHON/original/" 'full "^[^0-9].*\\.TIF$")
178 "/archives/RAID2/koukotsu/TAKUHON/original/" 'full "^[0-9].*\\.TIF$"))
180 ;; "/archives/RAID2/koukotsu/TAKUHON/" t "\\.TIF$")
184 (setq file (car rest))
185 (www-image-convert-images
186 "/archives/RAID2/koukotsu/TAKUHON/"
187 prev-file file (nth 1 rest))