image_uri {knitr} | R Documentation |
This function takes an image file and uses the markdown package to
encode it as a base64 string, which can be used in the img
tag in
HTML.
image_uri(f)
f |
the path to the image file |
a character string (the data URI)
Wush Wu and Yihui Xie
http://en.wikipedia.org/wiki/Data_URI_scheme
uri = image_uri(file.path(R.home("doc"), "html", "logo.jpg")) cat(sprintf("<img src=\"%s\" />", uri), file = "logo.html") if (interactive()) browseURL("logo.html") # you can check its HTML source