Function: mm-get-image

mm-get-image is a byte-compiled function defined in mm-decode.el.gz.

Signature

(mm-get-image HANDLE)

Documentation

Return an image instance based on HANDLE.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mm-decode.el.gz
(defun mm-get-image (handle)
  "Return an image instance based on HANDLE."
  (let ((type (mm-handle-media-subtype handle))
	spec)
    ;; Allow some common translations.
    (setq type
	  (cond
	   ((equal type "x-pixmap")
	    "xpm")
	   ((equal type "x-xbitmap")
	    "xbm")
	   ((equal type "x-portable-bitmap")
	    "pbm")
	   ((equal type "svg+xml")
	    "svg")
	   (t type)))
    (or (mm-handle-cache handle)
	(mm-with-unibyte-buffer
	  (mm-insert-part handle)
	  (prog1
	      (setq spec
		    (ignore-errors
		      (create-image (buffer-string)
				    (or (mm-image-type-from-buffer)
					(intern type))
				    'data-p)))
	    (mm-handle-set-cache handle spec))))))