I have a wordpress blog and I use Yoast for SEO purpose. I want my facebook and twitter posts to have a custom image cover, so I have written a php script that takes the cover image of a post, applies an overlay that I made and creates two new images.
What I want to know, is if there is a way to run this script when I click "Save Draft" or "Publish" and automatically set the new images as cover images for social media in Yoast.
Until now i have been doing this manually, adding the url of the newly created images to the Yoast section at the bottom of the editor when creating a new wordpress post. I have been searching the Yoast api for a while, but I am not proficient in this CMS, and the documentation is not exactly helpful.
Can at least someone point to a helpful direction? Is there anyone else that faced the same problem?
I don't know if this is where I should be asking question for a wordpress plugin, so I am sorry in advance, if it is not.