question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

working with svg image received from server as data

See original GitHub issue

My react app is receiving svg as response from an API call and it is currently rendered using below syntax

<span dangerouslySetInnerHTML={{__html: this.state.data.image}} />

I want to add pan-zoom features but not sure how to do it with this library. Could you please allow passing image data as props to this component or suggest any workarounds.

-thnx

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dy10commented, Jun 21, 2017

This works. Thanks a lot !

0reactions
lionkengcommented, Apr 23, 2019

Hi @lionkeng, Did you find a fix for the miniature feature not being correct ?

hi @KristianLonergan - I think we ended up not using the miniature feature at that point. That said, we were testing then with an older version of v2. Seems to be working now in another project where we are using this feature with v3. But we are not using dangerouslySetInnerHTML.

Read more comments on GitHub >

github_iconTop Results From Across the Web

load an svg from server and show it into an html element
I know it can show using <img> tag,but i need to write some events on the svg elements. $.get( "http://example.com/_assets/img/gptest.svg", ...
Read more >
Serve SVG with the Correct Content Type - CSS-Tricks
If you are trying to use SVG like <img src="image.svg"> or as a CSS background-image , and the file is linked to correctly...
Read more >
How to Use SVG Images in CSS and HTML – A Tutorial for ...
To do this, open the SVG image in VS code or your preferred IDE, copy the code, and paste it inside the <body>...
Read more >
The Best Way to Embed SVG on HTML (2021) - Vecta.io
When we embed an image onto HTML, it's always good to have alt and title attributes, for better accessibility. An alt attribute allows...
Read more >
Love Generating SVG With JavaScript? Move It To The Server!
The easiest way to put the generated SVG on the server is just to send the generated data with an AJAX request when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found