help-gnu-emacs
[Top][All Lists]
Advanced

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

help with image handling


From: Joe Corneli
Subject: help with image handling
Date: Thu, 24 Mar 2005 13:45:35 -0600

I want to download images from the web and display them in 
an emacs buffer.  It seemed to me that the following form
should work, as an example of how to do this:

(let ((content (progn
                 (set-buffer (get-buffer-create "*scratch*"))
                 (url-insert-file-contents 
"http://www.gnu.org/graphics/gnu-head-sm.jpg";)
                 (buffer-string)))
      (set-buffer (get-buffer-create "*Nero*"))
      (erase-buffer)
      (insert-image (create-image content 
                                  `,(nero-type-from-extension
                                     extension)
                                  t))))

However, when I switch to the *Nero* buffer, I just see a box,
not the actual image that I thought I was downloading.  What
should I be doing differently to actually get the image to display?


Note that this is in 

 GNU Emacs 22.0.50.4 (powerpc-apple-darwin7.5.0, X toolkit, Xaw3d scroll bars) 
of 2005-03-24


And the `nero-type-from-extension' function used above is defined here:

(defun nero-type-from-extension (extension)
  "Return the image type identifier associated with a file extension."
  (cdr (assoc extension '(("jpeg" . jpeg)
                          ("jpg" . jpeg)
                          ("xpm" . xpm)
                          ("xbm" . xbm)
                          ("gif" . gif)
                          ("eps" . postscript)
                          ("pbm" . pbm)
                          ("png" . png)
                          ("tiff" . tiff)))))




reply via email to

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