We are using SVG images more and more and I would like to put some of these inline using the <svg>...</svg>
code directly in the markup. I've done this successfully when the image is added as part of the Component Template as I just add the SVG code to the template. What I would also like to do is access the code within SVG images that are stored as image assets so rather than adding the SVG as the src attribute of an img tag, use the SVG code within the file instead.
I've tried using svgImgAssetObj.Multimedia.GetBinaryContent()
and writing out the result but that just gives me a type mismatch. Is there any way to do this on render?
My fallback is to publish the image and then use client side JavaScript to read the SVG code and put it in the markup, but this cancels out the reduction in http requests that putting an SVG inline achieves.
We're using Tridion2011 in case that's significant to any solution.