R/add_imgur_image.R
add_imgur_image.Rd
Getting images into email message bodies (and expecting them to appear for
the recipient) can be a harrowing experience. External images (i.e.,
available at public URLs) work exceedingly well and most email clients will
faithfully display these images. With the imgur_image()
function, we can
take a local image file or a ggplot2
plot object and send it to the Imgur
service, and finally receive an image (<img>
) tag that can be directly
inserted into an email message using compose_email()
.
The path to the local image we would like to deploy to Imgur and for which we'd like an image tag.
The Imgur Client ID value.
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.
The width to be used for the image, in pixels.
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.
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.
An HTML fragment that can be placed inside the message body wherever the image should appear.
To take advantage of this, we need to first have an account with Imgur and
then obtain a Client-ID
key for the Imgur API. This can be easily done by
going to https://api.imgur.com/oauth2/addclient
and registering an
application. Be sure to select the OAuth 2 authorization type without a
callback URL.