paperkey: use svg as image format to provide better scalability

This commit is contained in:
Dietmar Maurer 2020-10-20 12:04:51 +02:00
parent 23440482d4
commit c8774067ee

View File

@ -414,13 +414,13 @@ fn paperkey_html(data: &str, subject: Option<String>) -> Result<(), Error> {
println!("</p>"); println!("</p>");
let data = data.join("\n"); let data = data.join("\n");
let qr_code = generate_qr_code("png", data.as_bytes())?; let qr_code = generate_qr_code("svg", data.as_bytes())?;
let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD); let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD);
println!("<center>"); println!("<center>");
println!("<img"); println!("<img");
println!("width=\"{}pt\" height=\"{}pt\"", img_size_pt, img_size_pt); println!("width=\"{}pt\" height=\"{}pt\"", img_size_pt, img_size_pt);
println!("src=\"data:image/png;base64,{}\"/>", qr_code); println!("src=\"data:image/svg+xml;base64,{}\"/>", qr_code);
println!("</center>"); println!("</center>");
println!("</div>"); println!("</div>");
} }
@ -447,13 +447,13 @@ fn paperkey_html(data: &str, subject: Option<String>) -> Result<(), Error> {
println!("</p>"); println!("</p>");
let qr_code = generate_qr_code("png", key_text.as_bytes())?; let qr_code = generate_qr_code("svg", key_text.as_bytes())?;
let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD); let qr_code = base64::encode_config(&qr_code, base64::STANDARD_NO_PAD);
println!("<center>"); println!("<center>");
println!("<img"); println!("<img");
println!("width=\"{}pt\" height=\"{}pt\"", img_size_pt, img_size_pt); println!("width=\"{}pt\" height=\"{}pt\"", img_size_pt, img_size_pt);
println!("src=\"data:image/png;base64,{}\"/>", qr_code); println!("src=\"data:image/svg+xml;base64,{}\"/>", qr_code);
println!("</center>"); println!("</center>");
println!("</div>"); println!("</div>");