invidget icon indicating copy to clipboard operation
invidget copied to clipboard

[WIP] Accepting "format" as a query parameter

Open dsgpaiva opened this issue 4 years ago • 13 comments
trafficstars

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

dsgpaiva avatar Jul 06 '21 08:07 dsgpaiva

Known Bug: images using ?format=png aren't rendering the server icon.

image

dsgpaiva avatar Jul 06 '21 08:07 dsgpaiva

@pedrofracassi help

dsgpaiva avatar Jul 06 '21 09:07 dsgpaiva

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?

pedrofracassi avatar Jul 11 '21 17:07 pedrofracassi

I think sharp isn't converting that <image> tag that's embedded in the SVG variant, we'd have to figure it out.

dsgpaiva avatar Jul 11 '21 19:07 dsgpaiva

Maybe try this? https://stackoverflow.com/questions/58408753/svg-as-svgs-image-tag-not-working-while-using-with-sharp

pedrofracassi avatar Jul 13 '21 14:07 pedrofracassi

Any updates on this PR? Maybe the make an issue in the sharp Github.

Galaxy-Coding avatar Jul 21 '21 12:07 Galaxy-Coding

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.

dsgpaiva avatar Jul 23 '21 14:07 dsgpaiva

Also @almeidx when format isn't specified, should it default to SVG?

dsgpaiva avatar Jul 23 '21 14:07 dsgpaiva

Also @almeidx when format isn't specified, should it default to SVG?

To avoid breaking changes to the API, yes

almeidx avatar Jul 23 '21 15:07 almeidx

@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.

dsgpaiva avatar Jul 24 '21 17:07 dsgpaiva

You guys could always use ReSVG v2 added the ability to render images from external links

ghost avatar Mar 03 '23 15:03 ghost

Tested ReSVG and it did work

ghost avatar Mar 04 '23 13:03 ghost

Known Bug: images using ?format=png aren't rendering the server icon.

image

mostly likely due to https://github.com/SwitchbladeBot/invidget/pull/82

Vendicated avatar Jun 02 '24 18:06 Vendicated