Closed sollambert closed 2 weeks ago
Thanks for the report! Do you have repro code?
This should work for repro, untested. When the SVG element is created, the Base64 string is placed into the href attribute of the tag, whereas the data should be in the src attribute.
Should just be able to check if there is a successful Base64 decode of the passed string to the image function, unless we're expecting Base64 encoded URIs to be passed as well.
fn repro() {
let qr = QRBuilder::new("This is the QR data").build().unwrap();
let mut svg_builder = convert::svg::SvgBuilder::default();
svg_builder.image("BASE_64_STRING_HERE".to_string());
svg_builder.to_str(&qr);
}
Hey thanks for the repro.
Unfortunately I think you are confusing <image>
which are for SVGs and <img>
which is HTML
<image>
uses href
instead of src
see the example in the page I linked a bit bellow
Ah, well for whatever reason I was unable to display the image that was supplied as a base64 string wither with a MIME type prefix or without, wonder why that was the case.
I'll let you re-open if you are having the same problem
When creating an SVG using SvgBuilder, it does not infer to use a passed Base64 string as src for image and instead inserts the string into the href attribute of the constructed image tag.
Documentation implies this functionality is not intended, and a Base64 string should be able to be used as the image src. https://docs.rs/fast_qr/latest/fast_qr/convert/trait.Builder.html#tymethod.image