I was able to reproduce similar issue if i clicked the 'Run App' button, but if I use runApp() directly in the concole, the picture can be displayed as expected, not sure why though...
ps. my current working directory is the same as the file path of app.R
library(shiny)
library(shinydashboard)
title <- tags$a(href='https://google.com',
tags$img(src='b.jpg', width='100px',height='100px')) # an image downloaded from web (b.jpg under www folder)
header <- dashboardHeader( title = title, uiOutput("logoutbtn"))
ui <- dashboardPage(header, dashboardSidebar(), dashboardBody())
server <- function(input, output, session) {
}
shinyApp(ui, server)
Thank you for replying @ifendo ! I tried running the runApp()-function directly in the console, but it still does not work for me. Otherwise my code seems to be exactly the same as yours.
Could it perhaps be some updates I need to do?
By the way: the link works just fine. It's just the image-display that is faulty.
By default, RStudio searches in the 'www' folder. Try creating such a folder and place your image file in there. Make sure you still use the same path without 'www' for the src.
@frida facing the same issue.
It can display images from web links, but not from the local "www" foder.
@Thomas_Thurnherr static files are placed in "www" folder only, and the src path excludes "www". Seems like the static resource isn't available and giving 404. Found below error in Inspect Element -> console
@mdamircoder
I have the same issue! Running externally doesn't solve the problem though, with Firefox as well as Chromium.
Interestingly, functions such as includeMarkdown, sourcing from the same directory, seem to work correctly.
Edit : it was using shinyApp instead of runApp that was causing the app not to find the www folder.