From: tomo Date: Mon, 18 Apr 2005 14:36:37 +0000 (+0000) Subject: (album-convert-image): Expand relative path in argument `file'; don't X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9a36b5a6f00db36bbe37ef048191477347478d8d;p=elisp%2Falbum.git (album-convert-image): Expand relative path in argument `file'; don't convert fullsize file if `file' is JPEG. (album-convert-directory): Specify default pattern of image files. --- diff --git a/album.el b/album.el index 0d7ac01..3b5bb79 100644 --- a/album.el +++ b/album.el @@ -114,6 +114,7 @@ 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) @@ -189,13 +190,19 @@ (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) @@ -217,7 +224,11 @@ (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)))