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 |
Create a paste box input control for images.
pasteBoxInput(inputId, label, width = "100px", height = "100px")
pasteBoxInput(inputId, label, width = "100px", height = "100px")
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'. |
A Shiny tag list that creates a UI element for pasting images.
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) }
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) }