tags$img() doesn't render image in web browser

565 views
Skip to first unread message

Ranaivoson Herimanitra

unread,
Feb 11, 2016, 4:29:59 AM2/11/16
to Shiny - Web Framework for R


 Hello,

I built images using svg syntax then store them in www/images with png extension.

When within rstudio It renders perfectly but when I open my application in web browser images are broken.

Is it a bug ? How could I fix it?

My code looks like this:  tags$img(src="images/legende_redcircle.png")


Thanks in advance,


Herimanitra,

See attached snapshots
image_broken.png
image_local.png

Joe Cheng

unread,
Feb 12, 2016, 12:08:53 AM2/12/16
to Ranaivoson Herimanitra, shiny-...@googlegroups.com
You're going to have to send a reproducible code sample, I think. And please don't drop the list from your replies, thanks!

On Thu, Feb 11, 2016 at 9:05 PM Ranaivoson Herimanitra <airma...@gmail.com> wrote:
A red circle image is defined as follows:

<svg width="100" height="100">
  <circle cx="50" cy="50" r="10"  stroke-width="4" fill="red" />
</svg>


and saved as png

On Fri, Feb 12, 2016 at 8:04 AM, Ranaivoson Herimanitra <airma...@gmail.com> wrote:
I manually change extension to .svg. Images don't render anymore (both in RStudio and in the browser)


On Thu, Feb 11, 2016 at 10:45 PM, Joe Cheng <j...@rstudio.com> wrote:
Can you just use an .svg extension instead? I'd expect that to work. Though the contents shouldn't be the whole html page, just the svg data.

On Thu, Feb 11, 2016 at 3:11 AM Ranaivoson Herimanitra <airma...@gmail.com> wrote:
First of all, I wanted tags$svg() to display custom legend and discovered that It is not available in shiny so I wrote an html

with svg tag then I noticed that I can change the html extension into png extension. That's the story :)

On Thu, Feb 11, 2016 at 12:45 PM, Joe Cheng <j...@rstudio.com> wrote:
Interesting. Why are you storing svg images with a png extension?

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/a4efe829-b64f-4827-8e96-1a19eb373241%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages