-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Provide PNG instead of SVG for image caching #7908
Copy link
Copy link
Closed
Description
Current avatar are sent in either png or svg format, depending on existence of avatar for user.
But image loaders in android or ios doesn't support direct rendering of SVG images. Most of the times, need to write down custom code on top of image loaders to load SVG images. This created problem of inconsistency while loading images ( one avatar is assigned to another user) and caching. I think it's really easy to solve from server side by using simple trick
There are some libraries that allows quick conversion of SVG to PNG specifically for designed platform
- https://www.npmjs.com/package/svg2png
- https://www.npmjs.com/package/svg-to-png
- https://www.npmjs.com/package/save-svg-as-png
You can provide end-point as /avatar/username?format="png";height="20px";width="20px"
which will return png based on required attributes. Those images are easy to parse and in absolute format, so SDK or Android developer don't have to check for SVG or PNG format returned by server.
I hope you guys consider my request 👍
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels