base64_uri {xfun} | R Documentation |
Generate the Data URI for a file
Description
Encode the file in the base64 encoding, and add the media type. The data URI
can be used to embed data in HTML documents, e.g., in the src
attribute of
the <img />
tag.
Usage
base64_uri(x, type = mime_type(x))
Arguments
x |
A file path. |
type |
The MIME type of the file, e.g., |
Value
A string of the form data:<media type>;base64,<data>
.
Examples
logo = xfun:::R_logo()
img = xfun::html_tag("img", src = xfun::base64_uri(logo), alt = "R logo")
if (interactive()) xfun::html_view(img)
[Package xfun version 0.50 Index]