add_image {blastula} | R Documentation |
Create an HTML fragment for an embedded image
Description
Add a local image inside the body of the email with this helper function.
Usage
add_image(
file,
alt = "",
width = 520,
align = c("center", "left", "right", "inline"),
float = c("none", "left", "right")
)
Arguments
file |
A path to an image file. |
alt |
Text description of image passed to the |
width |
The width to be used for the image, in pixels. |
align |
The alignment to be used for the image. If not |
float |
The float value to be used for the image. If not |
Value
A character object with an HTML fragment that can be placed inside the message body wherever the image should appear.
Examples
# Create an HTML fragment that
# contains an image
img_file_path <-
system.file(
"example_files",
"test_image.png",
package = "blastula"
)
img_file_html <-
add_image(file = img_file_path)
# Include the image in the email
# message body by simply referencing
# the `img_file_html` object
email <-
compose_email(
body = md(
c(
"Hello,
Here is an image:\n",
img_file_html
)
)
)
if (interactive()) email
[Package blastula version 0.3.5 Index]