invidget
invidget copied to clipboard
[WIP] Accepting "format" as a query parameter
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.
- Closes #40
Known Bug: images using ?format=png
aren't rendering the server icon.
@pedrofracassi help
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 <image>
tag that's embedded in the SVG variant, we'd have to figure it out.
Maybe try this? https://stackoverflow.com/questions/58408753/svg-as-svgs-image-tag-not-working-while-using-with-sharp
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?
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
Known Bug: images using
?format=png
aren't rendering the server icon.
mostly likely due to https://github.com/SwitchbladeBot/invidget/pull/82