View source: R/sds_image_from_file.R
sds_image_from_file | R Documentation |
In HTML mode, knitr include_graphics()
will generate a <img src= >
tag to include
an image file. To do this, the image file needs to be in a place where it is available
for display when the HTML is rendered in a browser. For images in packages, this is
not going to work.
sds_image_from_file( filepath, width = "80%", height = NULL, tex_width = width, format = ifelse(knitr::is_html_output(), "html", "latex"), more_tags = "" )
filepath |
character string with path to the image file. The image file must be PNG or JPEG or something that works in HTML |
width |
An optional character string specifying the width in some
valid HTML format, e.g. |
height |
Like |
tex_width |
Optional character string giving width of image in a latex-suitable
format, e.g. "100pt". When |
more_tags |
An optional character string containing more text to be inserted into the |
Character string specifying output format from knitr processing. This will be set automatically when run within knitr.
A character string containing an <img>
tag with a b64 encoded image
as the value of the src=
field.
## Not run: # in an inline knitr chunk ... sds_image_from_file("myimage.png") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.