Currently, d3js generated SVG with linked images via :
svg.append("image")
.attr("xlink:href", "file.jpg")
.attr("width", width)
.attr("height", height)
.attr("class", "bg");
producing :
<image xlink:href="file.jpg" width="960" height="500" class="bg"></image>
, when dowloaded by v2.0, result into svg file with missing rasters.
The solution would be 1/ to convert file.jpg into a data URI string (var str
) using JS. 2/ to replace
<image xlink:href="file.jpg" ...
by
<image href="data:image/png;base64,<dataURI>" ...
3/ to repeat for each <image xlink:href=
found.
The JS code to do 1. have been discussed here while 1 & 2 are in demo there (v/96/). The script successfully replace the href link by an href with valid and working data uri, so the image is really embedded within the svg. Then, crowbar naturally download both the SVG code and the (embedded) images :)
Note: as my stack appears to require server side base64 convertion and my d3js skills are limited, I will not push further in this way. But most of it is there, and it should be good to add to crowbar.
Note: I didn't tested if the data_uri type extension should really match the image's extension.