all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* thumbs-image-type?
@ 2005-10-17 23:53 Bill Wohler
  2005-10-23 21:58 ` thumbs-image-type? Kim F. Storm
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Wohler @ 2005-10-17 23:53 UTC (permalink / raw)


It seems to me that the following should be renamed to image-type and
moved to image.el, or--probably better--calls to thumbs-image-type
should be replaced by image-type-from-file-header.

(defun thumbs-image-type (img)
  "Return image type from filename IMG."
  (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg)
	((string-match ".*\\.xpm\\'" img) 'xpm)
	((string-match ".*\\.xbm\\'" img) 'xbm)
	((string-match ".*\\.gif\\'" img) 'gif)
	((string-match ".*\\.bmp\\'" img) 'bmp)
	((string-match ".*\\.png\\'" img) 'png)
	((string-match ".*\\.tiff?\\'" img) 'tiff)))

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: thumbs-image-type?
  2005-10-17 23:53 thumbs-image-type? Bill Wohler
@ 2005-10-23 21:58 ` Kim F. Storm
  0 siblings, 0 replies; 2+ messages in thread
From: Kim F. Storm @ 2005-10-23 21:58 UTC (permalink / raw)
  Cc: emacs-devel

Bill Wohler <wohler@newt.com> writes:

> It seems to me that the following should be renamed to image-type and
> moved to image.el, or--probably better--calls to thumbs-image-type
> should be replaced by image-type-from-file-header.
>
> (defun thumbs-image-type (img)
>   "Return image type from filename IMG."
>   (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg)
> 	((string-match ".*\\.xpm\\'" img) 'xpm)
> 	((string-match ".*\\.xbm\\'" img) 'xbm)
> 	((string-match ".*\\.gif\\'" img) 'gif)
> 	((string-match ".*\\.bmp\\'" img) 'bmp)
> 	((string-match ".*\\.png\\'" img) 'png)
> 	((string-match ".*\\.tiff?\\'" img) 'tiff)))

I have added image-type-from-file-name to image.el.

I also added image-type-from-buffer inspired by the function
mm-image-type-from-buffer in mm-decode.el, and used it to
simplify image-file-from-file-header.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-23 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-17 23:53 thumbs-image-type? Bill Wohler
2005-10-23 21:58 ` thumbs-image-type? Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.