Function: image-type-from-file-name

image-type-from-file-name is an autoloaded and byte-compiled function defined in image.el.gz.

This function is obsolete since 29.1; use image-supported-file-p instead.

Signature

(image-type-from-file-name FILE)

Documentation

Determine the type of image file FILE from its name.

Value is a symbol specifying the image type, or nil if type cannot be determined.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
;;;###autoload
(defun image-type-from-file-name (file)
  "Determine the type of image file FILE from its name.
Value is a symbol specifying the image type, or nil if type cannot
be determined."
  (declare (obsolete image-supported-file-p "29.1"))
  (let (type first (case-fold-search t))
    (catch 'found
      (dolist (elem image-type-file-name-regexps first)
	(when (string-match-p (car elem) file)
	  (if (image-type-available-p (setq type (cdr elem)))
	      (throw 'found type)
	    ;; If nothing seems to be supported, return first type that matched.
	    (or first (setq first type))))))))