How to display a SVG image in shiny

I would like to display in my web application an SVG image that I have hosted in the images folder. First I tried to display it with a tag but it didn't work:

ui <- fluidPage(
  tags$img(src = "./images/SVG_Logo.svg", width = "99px")

Then I used the rsvg and htmltools packages:


#Load SVG image
miLogo <- rsvg_svg("./images/SVG_Logo.svg", width = 99)
miLogo_html <- as.character(miLogo)

ui <- fluidPage(

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


shinyApp(ui = ui, server = server)

But I couldn't get it to work either.

Could someone help me, please?

Best regards,

In the end, the tags$img function works perfectly. The error was in the source path. I have placed the SVG image inside the www/images/ folder. And I fixed it using this code:

ui <- fluidPage(
  tags$img(src = "./images/logo.svg", width = "99px")

I leave it here in case it helps a novice like me.

Thank you very much to all of you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.