Conversion the image to base64 when export to html file on org mode

When export to html file on org mode , did there have an solution which could conversion the local or remote image to base64 content, so that the reciver who I distrbute to could review those image

the org content like

[[cost-status.svg]]

I think I found the solution

(defun org-org-html--format-image (source attributes info)
  (format "<img src=\"data:image/%s+xml;base64,%s\"%s />"
      (or (file-name-extension source) "")
      (base64-encode-string
       (with-temp-buffer
        (insert-file-contents-literally source)
        (buffer-string)))
      (file-name-nondirectory source)))
(advice-add #'org-html--format-image :override #'org-org-html--format-image)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.