How to Check if An Image Exists in a Document and Generate One if Not

1 replies
Last updated: Apr 29, 2021
I am using this plugin for generating images, but i want to automate it, lets say no image has been added, this plugin should automatically generate an image for the document
you'd probably want to use document actions, i.e. when a document is published, check if there's an image and create one if not.

https://www.sanity.io/docs/document-actions

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?