image_uri

0th

Percentile

Encode an image file to a data URI

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.

Usage
image_uri(f)
Arguments
f
the path to the image file
Value

  • a character string (the data URI)

References

http://en.wikipedia.org/wiki/Data_URI_scheme

Aliases
  • image_uri
Examples
uri = image_uri(file.path(R.home("doc"), "html", "logo.jpg"))
cat(sprintf("<img src="%s" />", uri), file = "logo.html")
browseURL("logo.html")  # you can check its HTML source
Documentation reproduced from package knitr, version 0.9, License: GPL

Community examples

Looks like there are no examples yet.