Add a local image inside the body of the email with this helper function.

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 alt attribute inside of the image (<img>) tag for use when image loading is disabled and on screen readers. NULL default produces blank ("") alt text.

width

The width to be used for the image, in pixels.

align

The alignment to be used for the image. If not "inline", the image will appear in its own block, i.e. there will not be text to the left or right of it.

float

The float value to be used for the image. If not "none", text will flow around the image, and the align argument will be ignored.

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