fabricerin (version 0.1.1)

fabric_image_add: Add an image to a preexisting canvas element

Description

Add an image to a preexisting canvas element

Usage

fabric_image_add(
  cid,
  imgId,
  imgsrc,
  imgwidth = 500,
  imgheight = 500,
  left = 100,
  top = 100,
  angle = 0,
  opacity = 1,
  strokecolor = "darkblue",
  strokewidth = 1,
  selectable = TRUE
)

Arguments

cid

the id of the canvas element you want to add your image to

imgId

the of the image

imgsrc

the URL source of the image

imgwidth

the width of the image. Defaults to 500

imgheight

the height of the image. Defaults to 500

left

the image's position from the left relative to the canvas element. Defaults to 100

top

the image's position from the top relative to the canvas element. Defaults to 100

angle

the angle of rotation of the image. Defaults to 0 (no rotation)

opacity

the opacity of the image (from 0 to 1). Defaults to 1

strokecolor

the stroke color of the image. Defaults to 'darkblue'

strokewidth

the stroke width of the image. Defaults to 1

selectable

logical. If TRUE, the user can modify interactively the image's size, position and rotation. Defaults to TRUE

Value

an image inside a preexisting canvas element

Examples

Run this code
# NOT RUN {
if (interactive()) {

img1 <- "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/724px-R_logo.svg.png"
img2 <- "https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/dplyr.png"
ui <- fluidPage(

use_fabric(),



fabric_image(cid = "cimage",
             imgId = "Rimg",
             imgsrc = img1,
             imgheight = 200,
             imgwidth = 200),

fabric_image_add(cid = "cimage",
                 imgId = "rstudioimg",
                 imgsrc = img2,
                 imgwidth = 200,
                 imgheight = 200,
                 left = 400)
                 )

server <- function(input, output) {}

shinyApp(ui = ui, server = server)

}
# }

Run the code above in your browser using DataLab