loading...

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).

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

Arguments

url

The URL to launch the Shiny app. If both app = and baseurl =

app

The name of the Shiny application. 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

Examples

if (FALSE) {
# 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()
}