Rendering a card means loading the resource, fetching its thumbnail and drawing text with GD, so every generated PNG is written to disk and reused.
Where images are cached
Files are stored under the cache directory (by default modules/OgImages/data/og-image-cache, or the path set in Cache directory path) as {type}/{id}.png, or {type}/{id}_s{siteId}.png when the request carries a site_id. Because public page tags always include the site ID, a resource shown on two sites produces two cached files, each rendered with that site's template.
When a cached image is reused
A request is served from cache when the file exists and is younger than the Cache TTL (86400 seconds by default). With a TTL of 0 the disk cache is disabled: every request renders a fresh image, and no file is written. Files left over from an earlier non-zero TTL are ignored until you flush them or set a TTL again.
The HTTP response also carries Cache-Control: public, max-age=86400, so browsers, proxies and social crawlers may keep their own copy for up to a day regardless of the TTL setting.
Automatic invalidation
The module deletes cached files without any action on your part when:
| Event | What is removed |
|---|---|
| An item, item set, media, site page or site is updated through the API (including the admin forms) | That resource's file and all of its site variants |
| A template is saved, set as default or deleted | Every file for that template's resource type |
| A site override is saved from the site page or the template's Site Assignments | Every file for the affected resource types |
Blog post updates do not trigger invalidation; blog cards refresh when the TTL expires, the cache is flushed, or the TTL is set to 0.
Flushing manually
- Admin > OG Images: the Flush all link under the title clears every cached image after a confirmation. The Flush cache button on a template row clears only that resource type.
- Admin > OG Images > Settings: the Cache status line shows the image count and total size, with a Flush all caches button.
Flushing is safe at any time; images are regenerated on the next request.
Changing the cache directory
Enter an absolute path in Cache directory path and save. The module creates the {type} subdirectories on demand, but the base directory must exist and be writable by the web server user. Files in the old location are not moved or deleted.
If the directory is not writable the module keeps working: write errors are ignored and every request re-renders the image.