You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a web with users and didn't want to use the "default_user.svg" since it is boring. Found this package and fell in love with it immediately.
Problem
So I went ahead integrated it with my React project and since I don't want to "unsafely render svg text" on my web, I tried inline SVG like the following:
Hello @giekaton !
Abstract
I am building a web with users and didn't want to use the "default_user.svg" since it is boring. Found this package and fell in love with it immediately.
Problem
So I went ahead integrated it with my React project and since I don't want to "unsafely render svg text" on my web, I tried inline SVG like the following:
The above did not render because
#
is included in thesvgString
.Solution
So I tried encoding the string as such:
The above code was used as
return toDataURI(multiavatar("hello world!", false))
and what do you know, it renders!Advantages
For developers using multiavatar on the client side can easily render the avatars with
img
tag.Request
multiavatar function to include optional parameter
asDataURI?: boolean
(defaults to false)Real Life Usage
Edit:
The text was updated successfully, but these errors were encountered: