Back-end screenshot creation

I am looking to create a screenshot whenever a new post is created. Essentially a small preview of the post that will act as the image for social sharing.

I’ve built this using front-end plugins and it works okay, but it seems to hang and be relatively unreliable/unpredictable for scaled production use. There may be too many things happening with the front-end workflows.

It would probably make more sense to accomplish this on the back-end using a database trigger. Has anyone set up something like this before, or are there any plugins that can do it?

When you talk about backend, remember that the screenshot is happening on the client side so it still needs some plugin or js to do the actual screenshot. So, for this use case, there might be no advantage to moving it to the backend(except iif you want the screenshot to contain sensitive items)…but if you want to it could end up being complex imo managing database triggers…and I think the triggers watch for changes in a field of a data type, not when a data item is created…

Just try to get a suitable plugin…or write some js…my 1 cent.

1 Like

Thanks - it may not need to be a “screenshot” per se, just an image preview of the page that looks enough like it. The front-end plugins work OK, but in testing it seems like it randomly fails to work correctly about 10% of the time, which isn’t acceptable for production.

definetly doable with a server side action using js and a couple of libraries now that support for nodejs 18 is officially available. You do need to code the layout as well but it’s completely working on the backend.

1 Like

Thanks, I’ll look into how to accomplish this with JS. Having to code the layout is not an issue, it might even be better since I will be able to fully control the dimensions and standardize the look of the images.

One issue I was having with the front-end screenshots was having to change element sizing etc dynamically while the screenshot was happening in order to ensure consistency. Back end will eliminate this issue.

1 Like

you can take a screenshot of any web using apis, here one:

You’ll need to use Cloudinary, create a template there and then send images and text via api to get the images. It works well!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.