-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
SVG to PNG on the edge - Require help for implementation. #11
Comments
Bit more explanation on the idea and why I think it can be helpful.I had multiple approaches to this in mind, depending on what usecases you consider. The "big advantage" of allowing SVGs is that SVGs are vectorized, and support text directly. This means, a lot of banner images that are repetitive/textual can be generated much more easily if they were in SVG. Pseudo PHP code for eg:
With such a script, you can use This becomes more powerful with static site generators, where generating a SVG file is fairly similar to generating a XML text file (which SSGs are great at). At Generating this in SVG for all tools would be so much easier. Another similar note for wordpress-plugins. tl;dr: Generating an SVG is easier, faster, better for modern content-generation pipelines. Now on to your questions: Q1Since
Gets changed to (yes, domain is available)
The endpoint fetches the SVG, generates PNG/JPG/WEBP and serves whatever formats the client supports. Q2
Yes, I think such a usecase makes sense for "edge-compute". Most edge-worker-implementations will offer some storage API, but you'll likely end up using something like an S3 backend to do this at scale. A monetization strategy of charging once a domain crosses X requests, or Y images makes sense Q3
I don't think so. While the primary cool usecase is I can't think of a reason why twitter-dev-access might be required for this. Q4
No, this is more of a publishing workflow. See 1 above. Hope this helps. |
Closing this, thanks for the questions. I've linked this issue on the README. |
@captn3m0 vercel just released a new approach. They offer HTML->SVG->PNG and the library they use to render the PNG seems to work in their edge: https://github.com/yisibl/resvg-js |
resvg looks perfect. I think a good way to "solve" this would be to showcase :
Going to add a note to the README. |
POC repo based on Next.js Edge API route that can be deployed to Vercel. |
Hi Nemo / Anyone,
First off, this is a great repository of ideas. I decided to pick up -> this one.
Just to be clear that I understood this correctly, since opengraph protocol doesn't support SVG, I am supposed to fetch the og:image (if not Twitter:card / Facebook equivalent) value and replace it with the converted PNG link before inputting to social media opengraph parser?
Should this happen for any link with SVG automatically with a worker setup? Where would these converted pictures be stored?
Is this specific to a particular social media site like Twitter requiring dev access?
Where is the flow from? if from a particular_user_tweet with og:image = SVG -> Worker -> PNG replacement -> twitter parser? how do I connect this preparsing...is there a separate api for it?
{ not an issue. Creating this for discussion on an idea as per documentation below }
The text was updated successfully, but these errors were encountered: