Learn R Programming

blastula (version 0.2.1)

add_image: Helper function for adding an image

Description

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

Usage

add_image(file)

Arguments

file

a path to an image file.

Value

a character object with an HTML fragment that can be placed inside the message body wherever the image should appear.

Examples

Run this code
# NOT RUN {
# Create an HTML fragment that
# contains an image
img_file_path <-
  system.file(
    "img",
    "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 = "
    Hello!

    Here is an image:

    {img_file_html}
    ")
# }

Run the code above in your browser using DataLab