tomgreeen
Forum Replies Created
-
This is excellent, thanks. I’ll have a go saving the file from bsi_image_cache_built to S3 and then create my own URL rather than needing to rewrite the urls ending with /social-image.jpg/ before calling get_og_image_url – seems like an unnecessary step.
When you say it’s cleared out after post edit, does that mean bsi_image_cache_built simply runs again and overwrites the old one ?
Will let you konw if I’m successful, if of interest.
Huge thank yous on this !
That is very kind of you!
Currently, images live on S3 in the WP media library, but are served on a Cloudfront CDN – all relatively standard.
My headless front end (nextJS) queries WP via WPGrapqhl, to get the CDN path to the image – for, say, a featured image. So to try the above, I added a custom resolver adding ‘socialImage’ to the data graph, so that I could query that. The resolver ran get_og_image_url and returned the URL.I’m not sure how the BSI image is generated so hard to know what should happen instead – is it always on the fly, or generated once and then stored in a filesystem? I guess ideally whatever logic runs when a browser requests XXXXX/social-image.png would run inside my socialImage resolver. Or something!
Wow you guys are awesome ! Thanks for the snippets, I have go_for_id working inside my graphQl resovler, but the only issue is that as this is a headless site, my front end lives on a completely different domain (actually the WP install is on a subdomain of the front end with no public access) – so my-post/social-image.jpg/ doesn’t lead to a valid location.
I understand this is very likely outside the scope of this plugin but there isn’t a way to filter the URL of the image is there?