0

I am trying to display a picture on a shiny app, but there is issues whith source

I have my app.r in a folder and a logo.png inside a WWW folder next to my app

My code is

library(shiny)

ui <- fluidPage(
  tags$img(src="logo.png")
)

server<-function(input,output,session){}

shinyApp(ui = ui, server = server)

But it can t find the logo. Same issue when I try to link a css file. Is there a configuration to do? thanks

Johann
  • 77
  • 6
  • Try replacing `src = "logo.png"` with `src = "./www/logo.png"`. – Maurits Evers Nov 06 '22 at 23:32
  • 1
    @MauritsEvers - No, `src = "logo.png"` or `src = "/logo.png"` is correct. Please see the [docs](https://shiny.rstudio.com/reference/shiny/1.4.0/resourcePaths.html) on resource publishing. Johann your code is working fine on my system - How are you running that app - RStudio's `Run App` button? [Here](https://stackoverflow.com/questions/63838001/display-locally-stored-image-in-r-shiny/63844759#63844759) you can find a related answer. – ismirsehregal Nov 07 '22 at 07:31
  • @stefan I don't think you should delete your answer. It's not wrong and following our discussion might help others. I just wanted to point out when `addResourcePath` usually is needed. Cheers – ismirsehregal Nov 07 '22 at 10:39

1 Answers1

0

Thanks for addResourcePath, it works well. And it works when i use 'run app' button instead of the shortcut ctlr+enter (execute the selected code) eventhought i select all the code. Maybe i need to learn what is the difference. Thanks all for your help

Johann
  • 77
  • 6