Function: image-dired-thumb-name
image-dired-thumb-name is a byte-compiled function defined in
image-dired-util.el.gz.
Signature
(image-dired-thumb-name FILE)
Documentation
Return absolute file name for thumbnail FILE.
Depending on the value of image-dired-thumbnail-storage, the
file name of the thumbnail will vary:
- For use-image-dired-dir, make a SHA1-hash of the image file's
directory name and add that to make the thumbnail file name
unique.
- For per-directory storage, just add a subdirectory.
- For standard storage, produce the file name according to the
Thumbnail Managing Standard. Among other things, an MD5-hash
of the image file's directory name will be added to the
filename.
See also image-dired-thumbnail-storage.
Source Code
;; Defined in /usr/src/emacs/lisp/image/image-dired-util.el.gz
(defun image-dired-thumb-name (file)
"Return absolute file name for thumbnail FILE.
Depending on the value of `image-dired-thumbnail-storage', the
file name of the thumbnail will vary:
- For `use-image-dired-dir', make a SHA1-hash of the image file's
directory name and add that to make the thumbnail file name
unique.
- For `per-directory' storage, just add a subdirectory.
- For `standard' storage, produce the file name according to the
Thumbnail Managing Standard. Among other things, an MD5-hash
of the image file's directory name will be added to the
filename.
See also `image-dired-thumbnail-storage'."
(let ((file (expand-file-name file)))
(cond ((memq image-dired-thumbnail-storage
image-dired--thumbnail-standard-sizes)
(let ((thumbdir (cl-case image-dired-thumbnail-storage
(standard "thumbnails/normal")
(standard-large "thumbnails/large")
(standard-x-large "thumbnails/x-large")
(standard-xx-large "thumbnails/xx-large"))))
(expand-file-name
;; MD5 is mandated by the Thumbnail Managing Standard.
(concat (md5 (concat "file://" file)) ".png")
(expand-file-name thumbdir (xdg-cache-home)))))
((or (eq 'image-dired image-dired-thumbnail-storage)
;; Maintained for backwards compatibility:
(eq 'use-image-dired-dir image-dired-thumbnail-storage))
(expand-file-name (format "%s.jpg" (sha1 file))
(image-dired-dir)))
((eq 'per-directory image-dired-thumbnail-storage)
(expand-file-name (format "%s.thumb.jpg"
(file-name-nondirectory file))
(expand-file-name
".image-dired"
(file-name-directory file)))))))