Base64 padding (trailing equals) is only needed for concatenation. I don't think data URIs can be concatenated so I strip them here.
Do you use nushell? Try def datauri [file: path] {
$"data:((ls $file -m).type.0);base64,(open -r $file | encode base64 --nopad)"
} instead to avoid visiting a 6kb website that can update without your knowledge every time you want to do this