Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert images to data URIs #16

Open
nikclayton opened this issue Feb 27, 2019 · 2 comments
Open

Convert images to data URIs #16

nikclayton opened this issue Feb 27, 2019 · 2 comments

Comments

@nikclayton
Copy link
Contributor

Since write.as doesn't support hosting images directly, it would be handy if images linked to from the Org file were converted to data: URIs when the content is uploaded.

@dangom
Copy link
Owner

dangom commented Feb 27, 2019

Converting them to data URIs is easy, the problem is that write.as ignores <img> tags.

#+BEGIN_SRC emacs-lisp :results verbatim :exports both
(defun tob64 (filename)
  (base64-encode-string
   (with-temp-buffer
     (insert-file-contents filename)
     (buffer-string))))

(format "<img src=\"data:image/png;base64,%s\">"
    (tob64 "/path/to/img"))
#+END_SRC

If their snap.as service would offer an API, it'd be possible to upload images and link them. However the service is not free and doesn't have an API yet. An alternative would be imgur, but not sure if that's not against their terms of service.
Ideas?

@nikclayton
Copy link
Contributor Author

I opened an issue over there about that -- writefreely/writefreely#80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants