-
Notifications
You must be signed in to change notification settings - Fork 24
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
[WIP] Accepting "format" as a query parameter #42
base: master
Are you sure you want to change the base?
Conversation
@pedrofracassi help |
res.setHeader('Content-Type', 'image/svg+xml') | ||
res.send(inviteSVG) | ||
|
||
switch (req.query.format.toLowerCase()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause the request to fail if format is not passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One could fix the other issue as well (don't recall the #) to handle failed requests gracefully
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've just realized the fuck up, don't mind me. Will fix it soon.
How are we placing the icon in the image? Does this problem have something to do with sharp not being able to fetch the icon? Do we use base64? |
I think sharp isn't converting that |
Any updates on this PR? Maybe the make an issue in the sharp Github. |
No need to send them an issue, I just haven't got the time yet to pick this back up, I'll probably pick it up today. EDIT: Thanks @pedrofracassi for the suggestion, I'll test it when I can. |
Also @almeidx when format isn't specified, should it default to SVG? |
To avoid breaking changes to the API, yes |
@pedrofracassi Your suggestion didn't work. I wasn't able to convert the jpeg/gif file which is our guild icon inside the SVG, w/o using other libs, and I don't want to add more dependencies to this project. |
You guys could always use ReSVG v2 added the ability to render images from external links |
Tested ReSVG and it did work |
mostly likely due to #82 |
When
?format=<png|svg>
is present, it'll automatically convert the image to one of the two formats.If not specified, will return a SVG image.