The Resoc Netlify Image Engine turns Resoc image templates into images via a simple HTTP API. As the name suggests, it should be deployed to Netlify.
Create your own image engine:
Add your own Resoc image templates:
resoc-templates
. In other words, remove resoc-templates/title-description
.resoc-templates
.
For example, if you have two templates named t01
and t02
,
the template manifests will be resoc-templates/t01/resoc.manifest.json
and
resoc-templates/t02/resoc.manifest.json
.[Optional] Configure the Cross-origin resource sharing (CORS):
netlify.toml
, edit the Access-Control-Allow-Origin
header.
For example, if your engine is to be used by the
Social Images WordPress plugin
and your WordPress site is available at https://blog.example.com
,
set Access-Control-Allow-Origin = "https://blog.example.com"
Deploy your engine to Netlify:
Test your engine:
https://my-own-resoc-netlify-image-engine.netlify.app
.[your engine URL]/templates
. You should get a JSON document listing your templates.[your engine URL]/templates/[your template name]/demos/open-graph.jpg
.
For example, if you have a template named t01
, visit [your engine URL]/templates/t01/demos/open-graph.jpg
.
You should get a demo image.The following entry points are available:
/templates/[template-name]/content/[file-name]
.
For example /templates/my-template/content/resoc.manifest.json
./templates/[template-name]/images/[dimensions].[format]?[parameters]
.
For example /templates/my-template/images/open-graph.jpg?title=Hello
./templates/[template-name]/images/[dimensions].[format]
.
For example /templates/my-template/images/open-graph.jpg
.
The body is expected to be a JSON containing parameter values, eg. { "title": "Hello" }
./templates/[template-name]/demos/[dimensions].[format]
.
For example /templates/title-description/demos/twitter-card.jpg
In the entry points above:
[dimensions]
can be open-graph
, twitter-card
or an arbitrary resolution such as 1000x800
.[format]
can be jpg
, jpeg
or png
.