WordPress
Embed jsontoimg templates as signed images with the official WordPress plugin.
Install the jsontoimg plugin (v1.0.0). Editors pick a template, fill named layers, and the plugin mints a signed <img> — Gutenberg block, [jsontoimg] shortcode, or PHP helpers. Same signed CMS path as URL rendering: POST /api/v1/img/sign, then GET /api/v1/img/{template}?sig=. The API key never appears in HTML.
Requires WordPress 6.6 and PHP 7.4 or later.
Install
- Download
jsontoimg.zip— that filename, notjsontoimg-1.0.0.zip(a versioned zip nests the folder and WordPress will not activate it). - In WordPress, open Plugins → Add New → Upload Plugin.
- Choose the zip, install, and activate.
Source: github.com/jsontoimg/wordpress.
Credentials
- Create an API key under Integrations → API keys.
- In WordPress, open Settings → jsontoimg.
- Paste the key. Leave Base URL as
https://app.jsontoimg.comunless you self-host (a trailing/api/v1is stripped). - Click Test connection, then Save changes.
The key is stored in the WordPress options table (jsontoimg_api_key). It is never printed in frontend HTML.
Gutenberg block
- In the post editor, add the jsontoimg block.
- Pick a Template from the list (or paste an ID).
- Fill the schema-driven layer fields. Preview uses the signed image URL.
- Optional: Set as Featured Image — downloads the render into the Media Library and assigns it as the post thumbnail. The post type must support featured images. Save the post first if the button is disabled.
Shortcode
Classic content, or any place shortcodes run:
[jsontoimg template="DESIGN_ID" format="png" alt="Hello" class="aligncenter" layers='{"headline":{"text":"Hello"}}']layers is JSON. Template is the template attribute, not inside that JSON.
PHP helpers
Themes and other plugins can call the same signed-URL path:
echo jsontoimg_render_image([
'template' => 'DESIGN_ID',
'format' => 'png',
'alt' => get_the_title(),
'layers' => [
'headline' => ['text' => get_the_title()],
],
]);| Helper | Returns |
|---|---|
jsontoimg_sign_url( $template, $args ) | Signed URL string, or WP_Error |
jsontoimg_render_image( $args ) | Escaped <img> HTML (admins see an HTML comment on failure) |
jsontoimg_list_templates( $args ) | Template list, or WP_Error |
$args on jsontoimg_sign_url may include format, layers, variables, expiresIn, version, scale, and transparent. Minted URLs are cached in transients.
Billing and image_url
The first unique GET of a signed URL bills once. Later hits are cache hits on jsontoimg. The plugin also caches the minted URL, so a page view does not mint or bill again.
image_url layers must be:
- a public
https://…file ending in.png,.jpg,.jpeg, or.webp, or - a dashboard Assets path
/api/uploads/files/{id}
Placeholder CDNs without a file extension (and many that block server-side fetches) fail at render time. Use a real public file from the Media Library or the jsontoimg Assets library.
For a logo layer, send JSON like {"logo":{"image_url":"https://example.com/logo.png"}} — the plugin mints the signed URL for you.
These helpers use the same /api/v1 contract as the API reference. n8n: community node. Agents: MCP.