emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* embed base64 encoded images in exported html
@ 2012-04-23 17:33 Noah Hoffman
  2012-04-23 16:35 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Noah Hoffman @ 2012-04-23 17:33 UTC (permalink / raw)
  To: emacs-orgmode

Hello -

I am trying to export a monolithic html file by embedding
base64-encoded images, and I can't quite figure out how to prevent the
output from being escaped in one way or another... here's an example
of one permutation that doesn't do exactly what I want:

#+BEGIN_SRC R :results output
png('plot.png')
plot(1:10)
invisible(dev.off())
list.files(pattern = '*.png')
#+END_SRC

#+RESULTS:
: [1] "plot.png"

#+BEGIN_SRC python :results output raw :exports results
with open('plot.png', 'rb') as image:
    data = image.read()
    print '<img src="data:image/png;base64,%s">' % data.encode("base64")
#+END_SRC

#+RESULTS:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAMAAABKCk6nAAACuFBMVEUAAAABAQEDAwMEBAQHBwcJ
CQkKCgoMDAwNDQ0ODg4PDw8QEBARERESEhITExMUFBQVFRUWFhYXFxcYGBgZGRkaGhobGxscHBwf
Hx8gICAhISEiIiIjIyMkJCQlJSUmJiYnJycoKCgqKiorKyssLCwtLS0uLi4vLy8wMDAxMTEyMjI0
NDQ4ODg5OTk6Ojo7Ozs8PDw9PT0+Pj4/Pz9AQEBBQUFCQkJDQ0NERERFRUVGRkZHR0dISEhJSUlK
SkpLS0tMTExNTU1OTk5PT09QUFBRUVFSUlJTU1NUVFRVVVVXV1dYWFhZWVlaWlpbW1tcXFxdXV1e

<remainder truncated>

Here the "results" block is not exposed as raw html in the exported
file. Can anyone suggest how I might do this? I'm using emacs 23.4.1,
org-mode 7.8.03

Thanks a lot,
Noah

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

end of thread, other threads:[~2012-04-23 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 17:33 embed base64 encoded images in exported html Noah Hoffman
2012-04-23 16:35 ` Eric Schulte
2012-04-23 18:48   ` Noah Hoffman

Code repositories for project(s) associated with this public inbox

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

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).