Skip to content

Provide PNG instead of SVG for image caching #7908

@sacOO7

Description

@sacOO7

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

  1. https://www.npmjs.com/package/svg2png
  2. https://www.npmjs.com/package/svg-to-png
  3. 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 👍

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions