tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.38k stars 1.69k forks source link

Correctly handle SVGImageElement #165

Open jackhsu978 opened 7 years ago

jackhsu978 commented 7 years ago

Correctly handle SVGImageElement. If a node is an instance of SVGImageElement:

  1. Copy its width and height attributes to its style similar to this commit
  2. Inline/embed the image, which transforms the http(s) URL string (https://...) to base64 data URI string (data:image/png;...)

Here is an example: before and after

PS: I also add node_modules to .gitignore

tsayen commented 6 years ago

Hi, thanks for contributing! Sorry for the late reply, I've been quite busy for the last year. This change looks good to me, would merge it right away, but would be totally happy if there was a regression test for it, so I don't break this feature accidentally in the future. Therefore this PR will have to wait for a while until someone writes a test for it.