unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tom <adatgyujto@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Fetching an image from the net and inserting into the buffer
Date: Sat, 25 Oct 2014 06:54:14 +0000 (UTC)	[thread overview]
Message-ID: <loom.20141025T084722-579@post.gmane.org> (raw)

I tried this code which when evaluated should insert the
image fetched from the net at point, but it inserts a rectangle
instead:

(insert-image
 (with-current-buffer 
     (url-retrieve-synchronously
"http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png")
   (goto-char (point-min))
   (search-forward "\n\n") ;skip headers
   (create-image (buffer-substring (point) (point-max)) 'png)))

It's emacs 24.1.1 on windows. Image are supported. If I download
the image from the above URL to a file and use create-image on 
that file then it displays properly.

But why doesn't it work when I try to fetch it dynamically with
url retrieve?




             reply	other threads:[~2014-10-25  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25  6:54 Tom [this message]
2014-10-25  7:18 ` Fetching an image from the net and inserting into the buffer Eli Zaretskii
2014-10-25  7:31   ` Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20141025T084722-579@post.gmane.org \
    --to=adatgyujto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).