This function takes an image file and uses either the markdown package,
or RCurl or the built-in function to encode it as a base64 string,
which can be used in the img tag in HTML.
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