rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
892 stars 300 forks source link

Unable to insert png in the title #241

Closed vikram-rawat closed 7 years ago

vikram-rawat commented 7 years ago

I tried using

Title=tags$a( tags$img(src='nameofmyimage.png',width=180) )

Somehow it doesn't work in one scenario and it does in another. It just doesn't find the image. Same code and same image is used in both dashboards. It is my logo.

Is there any better method for inserting images in main baar

bborgesr commented 7 years ago

If you have a reproducible example, I can take a look at it. But without more to go on, I don't know what the problem might be. For the example below, I have a www folder and an image named "porto.jpg" inside it. Given that, this works just fine for me:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = tags$div("Porto", tags$img(src = "porto.jpg", width = "30"))),
  dashboardSidebar(),
  dashboardBody()
)

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

shinyApp(ui, server)

If I misunderstood your problem, please give a reproducible example and more description and I can reopen the issue.

vikram-rawat commented 6 years ago

HTMLTEMPLATE - Copy.zip

This is the App I was trying to write. there is nothing important in there it's just a learning app. You can ignore everything else apart from the title option.

vikram-rawat commented 6 years ago

image

This is how it looks like on my screen. I have no idea what's going wrong. can you please please please help.

vikram-rawat commented 6 years ago

and this is what I got for using

dashboardHeader(title = tags$div("Porto", tags$img(src = "boosthubs.png", width = "30")))

image

bborgesr commented 6 years ago

It works fine for me, without any changes to the code you attached:

screen shot 2017-09-08 at 3 14 59 pm

Are you running the app by clicking "Run App" or copy pasting the code into the console? The latter might not work.

So I don't know what your problem may be... Here's my output of devtools::session_info() (click on the arrow to expand):

devtools::session_info() ```r > devtools::session_info() Session info --------------------------------------------------------------------------- setting value version R version 3.4.1 (2017-06-30) system x86_64, darwin15.6.0 ui RStudio (1.1.355) language (EN) collate en_US.UTF-8 tz Europe/Lisbon date 2017-09-08 Packages ------------------------------------------------------------------------------- package * version date source assertthat 0.2.0 2017-04-11 cran (@0.2.0) backports 1.1.0 2017-05-22 CRAN (R 3.4.0) base * 3.4.1 2017-07-07 local bindr 0.1 2016-11-13 CRAN (R 3.4.0) bindrcpp 0.2 2017-06-17 CRAN (R 3.4.0) broom 0.4.2 2017-02-13 CRAN (R 3.4.0) bsplus * 0.1.0 2017-01-26 CRAN (R 3.4.0) colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0) compiler 3.4.1 2017-07-07 local data.table * 1.10.4 2017-02-01 CRAN (R 3.4.0) datasets * 3.4.1 2017-07-07 local devtools 1.13.2 2017-06-02 CRAN (R 3.4.0) digest 0.6.12 2017-01-27 CRAN (R 3.4.0) dplyr 0.7.1.9000 2017-07-17 Github (hadley/dplyr@fa36b50) DT * 0.2 2016-08-09 CRAN (R 3.4.0) evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1) flexdashboard * 0.5 2017-03-13 CRAN (R 3.4.0) foreign 0.8-69 2017-06-22 CRAN (R 3.4.1) ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.0) ggvis * 0.4.3 2016-07-22 CRAN (R 3.4.0) glue 1.1.1 2017-06-21 CRAN (R 3.4.1) graphics * 3.4.1 2017-07-07 local grDevices * 3.4.1 2017-07-07 local grid 3.4.1 2017-07-07 local gtable 0.2.0 2016-02-26 CRAN (R 3.4.0) highcharter * 0.5.0 2017-01-17 CRAN (R 3.4.0) htmltools 0.3.6 2017-04-28 cran (@0.3.6) htmlwidgets 0.9 2017-07-10 CRAN (R 3.4.1) httpuv 1.3.5 2017-07-04 CRAN (R 3.4.1) httr 1.2.1 2016-07-03 CRAN (R 3.4.0) igraph 1.0.1 2015-06-26 CRAN (R 3.4.0) jsonlite 1.5 2017-06-01 cran (@1.5) knitr 1.16 2017-05-18 CRAN (R 3.4.0) lattice 0.20-35 2017-03-25 CRAN (R 3.4.1) lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.0) lubridate 1.6.0 2016-09-13 CRAN (R 3.4.0) magrittr 1.5 2014-11-22 CRAN (R 3.4.0) memoise 1.1.0 2017-04-21 CRAN (R 3.4.0) methods * 3.4.1 2017-07-07 local mime 0.5 2016-07-07 CRAN (R 3.4.0) mnormt 1.5-5 2016-10-15 CRAN (R 3.4.0) munsell 0.4.3 2016-02-13 CRAN (R 3.4.0) nlme 3.1-131 2017-02-06 CRAN (R 3.4.1) parallel 3.4.1 2017-07-07 local pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.0) plotly * 4.7.0 2017-05-28 CRAN (R 3.4.0) plyr 1.8.4 2016-06-08 CRAN (R 3.4.0) psych 1.7.5 2017-05-03 CRAN (R 3.4.0) purrr 0.2.2.2 2017-05-11 CRAN (R 3.4.0) quantmod * 0.4-10 2017-06-20 CRAN (R 3.4.0) R6 2.2.2 2017-06-17 CRAN (R 3.4.0) Rcpp 0.12.12 2017-07-15 CRAN (R 3.4.1) reshape2 1.4.2 2016-10-22 CRAN (R 3.4.0) rlang 0.1.1 2017-05-18 CRAN (R 3.4.0) rlist 0.4.6.1 2016-04-04 CRAN (R 3.4.0) rmarkdown 1.6 2017-06-15 CRAN (R 3.4.0) rprojroot 1.2 2017-01-16 CRAN (R 3.4.0) rsconnect 0.8.4 2017-08-02 Github (rstudio/rsconnect@e608e23) scales 0.4.1 2016-11-09 CRAN (R 3.4.0) shiny * 1.0.5 2017-08-23 cran (@1.0.5) shinydashboard * 0.6.1 2017-09-08 local shinythemes * 1.1.1 2016-10-12 CRAN (R 3.4.0) stats * 3.4.1 2017-07-07 local stringi 1.1.5 2017-04-07 cran (@1.1.5) stringr 1.2.0 2017-02-18 cran (@1.2.0) tibble 1.3.3 2017-05-28 CRAN (R 3.4.0) tidyr 0.6.3 2017-05-15 cran (@0.6.3) tools 3.4.1 2017-07-07 local TTR * 0.23-1 2016-03-21 CRAN (R 3.4.0) utils * 3.4.1 2017-07-07 local viridisLite 0.2.0 2017-03-24 CRAN (R 3.4.0) withr 2.0.0 2017-07-28 cran (@2.0.0) xtable 1.8-2 2016-02-05 CRAN (R 3.4.0) xts * 0.10-0 2017-07-07 CRAN (R 3.4.1) yaml 2.1.14 2016-11-12 CRAN (R 3.4.0) zoo * 1.8-0 2017-04-12 CRAN (R 3.4.0) ```


Update the relevant packages to at least what I have and see if the problem persists. Please also post the output you get when you do devtools::session_info() (after you click "Run App" and close it).