Rueben
January 11, 2020, 8:57am
1
Hi,
I have been able to display an image in a shiny application with the code below with the image in a www folder:
headerPanel(
list(tags$head(tags$style()),
HTML('<img src="image.png", height="100px",width="20px style="float:left"/>'))),
Please does anybody know how to add a hyperlink to this code, to enable a user to click the image and hyperlink it to another site? Thanks in advance.
cderv
January 11, 2020, 9:31am
2
in HTML, it should be like this
<a href="https://newsite.com"><img src="image.png" title="Example Image Link" width="600" height="400" /></a>
that could be written as is or using htmltools shiny helper
tags$a(
href="https://newsite.com",
tags$img(src="image.png",
title="Example Image Link",
width="600",
height="400")
)
I think you can adapt to your example and use case.
Hope it helps
4 Likes
Rueben
January 11, 2020, 10:05am
3
Hi,
Thank you very much for the quick response. Your solution worked perfectly well for me. Thanks.
cderv
January 11, 2020, 10:10am
4
Glad it works!
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
system
Closed
February 1, 2020, 10:10am
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.