(album-convert-image): Expand relative path in argument `file'; don't
authortomo <tomo>
Mon, 18 Apr 2005 14:36:37 +0000 (14:36 +0000)
committertomo <tomo>
Mon, 18 Apr 2005 14:36:37 +0000 (14:36 +0000)
convert fullsize file if `file' is JPEG.
(album-convert-directory): Specify default pattern of image files.

album.el

index 0d7ac01..3b5bb79 100644 (file)
--- a/album.el
+++ b/album.el
                                     dest-dir)))))
 
 (defun album-convert-image (dest-dir prev-file file next-file)
+  (setq file (expand-file-name file))
   (let* ((ret
          (with-temp-buffer
            (call-process "identify" nil t t file)
             (expand-file-name "fullsize" dest-dir))
       (make-directory
        (expand-file-name "fullsize" dest-dir)))
-    (call-process "convert" nil nil nil
-                 file
-                 (expand-file-name
-                  (concat
-                   (file-name-sans-extension
-                    (file-name-nondirectory file)) ".jpg")
-                  (expand-file-name "fullsize" dest-dir)))
+    (if (string= (downcase (file-name-extension file))
+                "jpg")
+       (call-process "ln" nil nil nil
+                     "-f"
+                     file
+                     (expand-file-name "fullsize" dest-dir))
+      (call-process "convert" nil nil nil
+                   file
+                   (expand-file-name
+                    (concat
+                     (file-name-sans-extension
+                      (file-name-nondirectory file)) ".jpg")
+                    (expand-file-name "fullsize" dest-dir))))
     dest))
 
 (defun album-convert-images (dest-dir &rest source-images)
          (setq files
                (append files
                        (directory-files source-dir 'full pat))))
-      (setq files (directory-files source-dir 'full)))
+      (setq files
+           (let (case-fold-search)
+             (directory-files
+              source-dir 'full
+              ".+\\.\\(tiff\\|jpg\\|JPG\\|jpeg\\|gif\\|png\\)$"))))
     (album-convert-images dest-dir files)))