Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide PNG instead of SVG for image caching #7908

Closed
sacOO7 opened this issue Aug 26, 2017 · 2 comments
Closed

Provide PNG instead of SVG for image caching #7908

sacOO7 opened this issue Aug 26, 2017 · 2 comments
Assignees

Comments

@sacOO7
Copy link

sacOO7 commented Aug 26, 2017

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 👍

@rafaelks
Copy link
Contributor

This is also important for the Android and iOS app. Today we're creating the "initials" avatar manually so we don't need to add support to render SVG.

I guess this is also better for caching the image.

@lindoelio
Copy link
Contributor

Hello @sacOO7 and @rafaelks! For this issue, I will to provide a new PR for only quick conversion of SVG to PNG specifically. PNG will be a absolute response format by default.

The power of supporting the mentioned parameters for custom response (such as "format", "width" and "height") was moved to a new specific issue (#8178), for a faster increment of this on our develop branch, since the "extra power" will need for more discussion about security and capacity at server side, besides a more expensive code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants