emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A few issues with thumbs.el


From: Juanma Barranquero
Subject: Re: A few issues with thumbs.el
Date: Sat, 28 May 2005 20:00:05 +0200

> It would be much better for the user if the thumbnail file names are
> based on something meaningful, such as the user's file name (or at
> least part of it).  It is ok to add other info such as an md5 checksum
> to make them unique, but please don't make them entirely meaningless.

I really don't understand why is that important; these files are not
for human consumption. But I don't really care one way or the other.
The real issue is not making them unique (although there's also a
small problem with that), but making them valid. As it is on CVS,
thumbs-thumbname does not produce valid MSDOS/Windows filenames.

I think the following approach can work, but still is could break on
non-Unix, non-Windows environments:

(defun thumbs-thumbname (img)
  "Return a thumbnail name for the image IMG."
  (convert-standard-filename
   (let ((filename (expand-file-name img)))
     (format "%s/%s-%x.jpg"
             thumbs-thumbsdir
             (subst-char-in-string
              ?\s ?\_
              (apply
               'concat
               (split-string filename "/")))
             (sxhash filename)))))

-- 
                    /L/e/k/t/u




reply via email to

[Prev in Thread] Current Thread [Next in Thread]