Package 'picClip'

Title: Paste Box Input for 'shiny'
Description: Provides a 'shiny' input widget, pasteBoxInput, that allows users to paste images directly into a 'shiny' application. The pasted images are captured as Base64 encoded strings and can be used within the application for various purposes, such as display or further processing. This package is particularly useful for applications that require easy and quick image uploads without the need for traditional file selection dialogs.
Authors: Matt Deppe
Maintainer: Matt Deppe <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-02-21 03:14:18 UTC
Source: https://github.com/deppemj/picclip

Help Index


Paste Box Input

Description

Create a paste box input control for images.

Usage

pasteBoxInput(inputId, label, width = "100px", height = "100px")

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control.

width

The width of the paste box, e.g., '100px'.

height

The height of the paste box, e.g., '100px'.

Value

A Shiny tag list that creates a UI element for pasting images.

Examples

if (interactive()) {
  library(shiny)
  library(base64enc)

  ui <- fluidPage(
    pasteBoxInput("testInput", "Paste Image Here", "300px", "150px"),
    uiOutput("image")
  )

  server <- function(input, output, session) {
    observeEvent(input$testInput, {
      if (!is.null(input$testInput) && input$testInput != "") {
        output$image <- renderUI({
          tags$img(src = input$testInput, style = "max-width: 100%; height: auto;")
        })
      }
    })
  }

  shinyApp(ui, server)
}