Learn R Programming

RTest (version 1.2.6)

png2base64: Converts a PNG File Into a Base64 String for Using IT as Inline Image in HTML Files

Description

This function creates a base64 string of a PNG (e.g. png) directly into HTML via the data function.

Usage

png2base64(file, img.returnAsTag = FALSE, img.title = "image",
  img.width = NULL)

Arguments

file

(character) Path to PNG image.

img.returnAsTag

(boolean) TRUE, img is returned as HTML img-tag; FALSE, raw image base64 content is returned.

img.title

(character) Title of the HTML img-tag.

img.width

(character) With for HTML img-tag.

Value

See paramter img.returnAsTag.

Details

The input file is read and a base64 string encoded The returned file is the value of the img attribute src.