0

I have hundreds of images stored locally which I want to include in my Shiny App table. I start by creating a path to each image as a variable

path = "/Users/author/folder/subfolder/"

df%<>% mutate(Image = paste(path, ID, ".png", sep = ""))

I subsequently process them as advised on Adding an image to a datatable in R


for (i in df$Image) {

  df$ProcessedIcon <- knitr::image_uri(i)

}

I then create the Icon variable with the processed information


df%<>% mutate(Icon = paste("<img src=", ProcessedIcon ,"></img>", sep = ""))

my server looks like

server <- function(input, output) {
  
  
  table2 <-  reactive  ({

    df %>%
      select(Icon, Category, SubCategory, Item)

  })
  
  
  
  output$foodtable <- DT::renderDataTable({
    
    
    DT::datatable(table2(), escape = FALSE)
    
    
  })

}

My icons still looks like this

enter image description here

Why are the icons not loading properly?

What am I missing?

Seni
  • 41
  • 6
  • 3
    Local paths must be added as resources using `addResourcePath` see [here](https://stackoverflow.com/questions/63838001/display-locally-stored-image-in-r-shiny) – danlooo Apr 27 '22 at 14:34

0 Answers0