webshot_shiny: Create the screenshot image of a Shiny application with a...

View source: R/webshot_shiny.R

webshot_shinyR Documentation

Create the screenshot image of a Shiny application with a click icon

Description

The webshot_shiny() function is designed to create the screenshot image of a Shiny application, with an icon suggesting to click on it for launching the application. The image created can then be used by launch_shiny() in a bookdown to differ the start of Shiny application, while displaying useful information to the user (how the Shiny application would look like if it was started).

Usage

webshot_shiny(
  url,
  app = NULL,
  imgdir = "images/shinyapps",
  img = paste0(imgdir, "/", app, ".png"),
  width = 790,
  height = 500,
  offsetx = 30,
  offsety = 30,
  delay = 10,
  ...
)

Arguments

url

The URL to launch the Shiny app, or to a screenshot of the app in PNG format.

app

The name of the Shiny application. If NULL, the base name of the URL without the extension is used. are provided, you don't need to specify it.

imgdir

The directory without trailing "/" where images relative to Shiny applications are stored. By default, it is relative to current directory, in images/shinyapps subdirectories.

img

The path to the image that is created. Not needed if ⁠app =⁠ and ⁠imgdir =⁠ are provided.

width

The requested weight of the screenshot (it may differ if the Shiny application defines other (limit) values.

height

The requested height of the screenshot (idem).

offsetx

The offset from left where to place the click icon in pixels.

offsety

The offset to bottom where to place the click icon in pixels.

delay

Time to wait (in sec) after the Shiny application has started and before the screenshot is taken. If the screenshot does not contain the complete application UI, try increase this value.

...

Further arguments passed to launch_shiny() but not used here.

Value

The path to the created image, invisibly.

See Also

launch_shiny()

Examples

## Not run: 
# We wait 10 sec to make sure it is loaded when the screenshot is taken
(webshot_shiny("https://phgrosjean.shinyapps.io/histogram/", delay = 10))
 # Now, look at this image. You can use it with launch_shiny()

## End(Not run)

SciViews/learndown documentation built on Sept. 17, 2024, 8:06 a.m.