fix: make avatar image work on more platforms (use xlink:href)

Without it delta touch (qt) can not render the avatar image
and also inkscape does not show it either.
This commit is contained in:
Simon Laux
2023-06-21 00:47:16 +02:00
committed by link2xt
parent 7b49fb2eb6
commit 0d8a76593a

View File

@@ -121,6 +121,7 @@ fn inner_generate_secure_join_qr_code(
w.elem("svg", |d| {
d.attr("xmlns", "http://www.w3.org/2000/svg")?;
d.attr("viewBox", format_args!("0 0 {width} {height}"))?;
d.attr("xmlns:xlink", "http://www.w3.org/1999/xlink")?; // required for enabling xlink:href on browsers
Ok(())
})?
.build(|w| {
@@ -240,7 +241,7 @@ fn inner_generate_secure_join_qr_code(
d.attr("preserveAspectRatio", "none")?;
d.attr("clip-path", "url(#avatar-cut)")?;
d.attr(
"href", /*might need xlink:href instead if it doesn't work on older devices?*/
"xlink:href", /* xlink:href is needed otherwise it won't even display in inkscape not to mention qt's QSvgHandler */
format!(
"data:image/jpeg;base64,{}",
base64::engine::general_purpose::STANDARD.encode(img)