This function generates an HTML <img>
tag and an XML <file>
tag for a given image.
The image can be processed to adjust its dimensions and encoded in base64 for embedding.
xml_image(image, image_alt, adapt_images = FALSE, width = NULL, height = NULL)
A list with two elements:
img
character
: HTML string containing the <img>
tag.
fimg
character
: XML string containing the base64-encoded <file>
tag.
character
Path to the image file. If the string is empty, the function returns empty values.
character
Alternative text for the image, used for accessibility purposes (e.g., screen readers).
logical
, default FALSE
If TRUE
, the image dimensions are adjusted to the specified width
and height
.
If FALSE
, the original dimensions are used.
numeric
or NULL
, default NULL
Desired width for the image. Only used when adapt_images = TRUE
. If NULL
,
the width is derived from the image file.
numeric
or NULL
, default NULL
Desired height for the image. Only used when adapt_images = TRUE
. If NULL
,
the height is derived from the image file.
If adapt_images = TRUE
, the function resizes the image using the specified dimensions.
If adapt_images = FALSE
, the function reads the image's original dimensions and uses them.
The image is embedded as a base64 string in the <file>
tag for compatibility with XML-based systems.